please dont rip this site

Learning to Program with the Cybiko Handheld Computer Using B2C

Chapter 11 : While

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 16:44, local time: 2024/5/4 01:46,
TOP NEW HELP FIND: 
18.218.55.14:LOG IN

 ©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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://techref.massmind.org/techref/cybiko/b2c/ch11.htm"> cybiko b2c ch11</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to techref.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .