0

looping methods of statements

how one loops while,if and other loops

20th Jun 2018, 6:38 PM
Kanana Kanana
Kanana Kanana - avatar
7 Réponses
+ 1
if is not a loop
20th Jun 2018, 8:17 PM
hinanawi
hinanawi - avatar
+ 1
Kanana Kanana while continuously executes the code within it, if only does it once.
20th Jun 2018, 8:24 PM
hinanawi
hinanawi - avatar
0
then explain how if works hinanawi
20th Jun 2018, 8:19 PM
Kanana Kanana
Kanana Kanana - avatar
0
Kanana Kanana if(condition) {do stuff} means that if the condition is true (example: 2*2 == 4/2) the expression below it will be executed. if not, everything within the block is skipped and if there's else statements those are checked after.
20th Jun 2018, 8:21 PM
hinanawi
hinanawi - avatar
0
hinanawi but also While does the same execution as the one you have just mentioned so how different is it??
20th Jun 2018, 8:23 PM
Kanana Kanana
Kanana Kanana - avatar
0
further explain the use of for also
20th Jun 2018, 8:26 PM
Kanana Kanana
Kanana Kanana - avatar
0
Kanana Kanana for has a more complex structure, and usually has a variable that it keeps track of. for is mostly used to execute code a certain set number of times.
20th Jun 2018, 8:27 PM
hinanawi
hinanawi - avatar