I have another swift question... | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

I have another swift question...

In THIS CODES DISCRIPTION IT SAID A while loop performs a set of statements until a condition becomes false. These kinds of loops are best used when the number of iterations is not known before the first iteration begins. while evaluates its condition at the start of each pass through the loop. The while loop is demonstrated in the example below WHAT DOES IT TRYING TO SaY CAN YOU GUYS PLEA HELP, MY ENGLISH IS BAD:( THANKS, THIS IS THE CODE UNDER IT while a < b { print(a) a+=1 }

16th Jun 2020, 9:27 AM
Coder
Coder - avatar
4 Respuestas
+ 1
while age < 18 { mayIDrinkAlcohol(age) increaseEachYear(age) } Does this help? 😉 Or... answer = 0 while answer < 42 { print("This is not the answer") answer = answer + 1 }
18th Jun 2020, 1:02 AM
Sandra Meyer
Sandra Meyer - avatar
+ 1
First of all, no you may not drin alcachole it is bad.... second of all, what do you mean by answer +1
19th Jun 2020, 1:13 AM
Coder
Coder - avatar
+ 1
thanks tho
19th Jun 2020, 1:13 AM
Coder
Coder - avatar
0
answer + 1 increases the number by one. If the number would not change, the loop would be infinite, because the condition 'while answer < 42' would evaluate as true forever.
19th Jun 2020, 12:53 PM
Sandra Meyer
Sandra Meyer - avatar