0
Que diferencia tiene El Bucle while con if, si evalúan lo mismo ?
2 Respuestas
+ 3
To add to what @P R explained,
while(<condition>) is used to repeat the execution of the code following the "while" as long as <condition> evaluates to true.
if(<condition>) is used in branching, or making decision, the block of code following the "if" will be executed only when <condition> evaluates to true. If there's an "else" part combined with "if" the block of code following "else" will be executed if <condition> specified in "if" evaluates to false.
Hope this helps, although, the question was not in English.
+ 4
Translation : What difference does the while loop have with if, if they evaluate the same?
While is a looping statement (block of statement inside will be executed repeatedly till the condition is true)
and if is a conditional statement( block of statement inside will be executed if condition is true)