As mentioned, while-loops can make a chunk of program code run over and over until the condition
of the while-loop becomes false. Here's an example that asks you to type a word. Suppose we want it to stop asking
us to type words if we type the word "done" (without the quotes).
The code won't quite work. What condition you put in the while ... do line that is true if word$\ne$"done" and
false if word is equal to done?
Now you try. Put a condition in the while ... do line to stop the while loop when variable word is equal to "done".
Type your code here:
See your results here:
This code will not run! What condition will you put in the while loop to cause it to have a true
condition as long as the text in variable word is $\ne$ done?
Show a friend, family member, or teacher what you've done!
Here is a share link to your code:
Does your code work? Want to run it on your iPhone?
Here's your code:
Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.
Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into
Then click the "Use on iPhone" button that you'll see.