You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IsaacShelton edited this page Mar 21, 2022
·
1 revision
While Statement
While statements are used to conditionally execute a block of code while a condition is true
while condition {
// ...
}
while(condition){
// ...
}
while condition, // ...
while condition // ...
while(condition) // ...
while(condition), // ...
Execution Condition
If the condition is true, then the code inside the block will be executed or be re-executed
Usage example
import basics
func main {
value int = scanInt("Please don't enter 10: ")
while value != 10 {
value = scanInt("Please don't enter 10: ")
}
print("You entered 10, goodbye")
}