The While command is another type of looping command. Like the For command, While executes until a condition is met. Here is the form of the While command:
while [conditional] 'things to do wend dim a as int a=1 while a<10 print "a=", a a=a+1 wend
The Wend command ends a while loop.
DO THIS |
Copy the
file "c:\
\B2Cv5\tutorial\ch11.b2c" to "C:\
\B2Cv5\ch11.b2c".
Then execute the command "build ch11.b2c" Download the ch11.app file
to the cybiko
This example program plays "Hi/Low" a number game where the user has to guess the computer's random number 'Hi Low Number Guesser dim guess as int dim tries as int dim number as int tries=0 number = rnd(100)+1 while(guess <> number) print "enter your guess" input guess if guess < number then print guess, " is too low" tries=tries+1 elseif guess > number then print guess, " is too high" tries=tries+1 end if wend print "You guessed it." print "The number was ", number print "It took you ", tries, " tries" dim a input a
|
file: /Techref/cybiko/b2c/ch11.htm, 2KB, , updated: 2008/6/13 15:44, local time: 2024/11/9 15:24,
3.147.48.240:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/techref/cybiko/b2c/ch11.htm"> cybiko b2c ch11</A> |
Did you find what you needed? |