Download presentation
Presentation is loading. Please wait.
1
GCSE Computing:: While Loops
2
While Loops: Why we need them
While loops will repeat something until the user does something that the program allows; The following would be good reasons for using a While Loop: You want to stop the user from entering a value below 0 For example when pricing items; You want to do something until the time runs out For example you want to keep a count of the number of customers entering your shop until closing time; You want to continue running your program until there is an error For example you want to keep printing until the ink runs out
3
While Loops: In practice
The following code asks the user to enter their name, if no name is entered then it will keep requesting until something is entered: Dim sName sName = Inputbox (“Please enter your name”) While sName = “” Wend The following code will run the procedure count_customers continuously until the shop closes: Dim tTime tTime = Now() While tTime < “17:00” count_customers()
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.