0
I am having diffculty to understand java in condition and loops first section?
7 Réponses
+ 1
Thanks Denis it actually worked
0
Could you specify? Are you talking about a specific loop or condition or in general?
0
loop or condition
0
oh okay
0
The logic is the same as loops and conditions in other languages. If it is easier for you, start with another language. You can eventually come back to Java and see that it does not differ too much from other programming languages.
Good luck & happy coding!
0
I want to add that Java is quite a simple language and apart from the oop aspect one of the easiest to start with and build up on later (imho)
0
Conditions: Something will happen if the condition is fulfilled.
int a = 2;
int b = 3;
If (a < b){
//some code
}
If (a + b > 0){
//some code
} else { // when a+b < or = 0
//some code
}
If you want to repeat something use loops.
If you know how often use a for-loop.
For (int i = 0; i < 10; i++){
//some code
}
If you know the condition but not when it will be fulfilled use a while loop
while (a + b < 0){
//some code
}