Clippy is correct...

by Pete (Login The-Universe)
Admin

 

CASE ELSE in QB allows everything that doesn't fit to go there...

SELECT CASE a
CASE 1: PRINT "A"
CASE 2: PRINT "B"
CASE ELSE : PRINT "Invalid selection. Try Again"
END SELECT

You can also write it this way...

SELECT CASE a
CASE 1
PRINT "A"
CASE 2
PRINT "B"
CASE ELSE
PRINT "Invalid selection. Try Again"
END SELECT

Yo will also need a way to get back to the input. What I like to do is put the routine in a DO/LOOP

DO
INPUT "Pick a number between 0 and 3: "; a
SELECT CASE a
CASE 1
PRINT "Yes, 1 is between 0 and 3."
EXIT DO
CASE 2
PRINT "Yes, 2 is between 0 and 3."
EXIT DO
CASE ELSE
PRINT "Invalid selection. Try Again"
PRINT
END SELECT
LOOP

--------

Bcause the CASE ELSE does not have an EXIT DO, the routine loops.

I hope this gives you some ideas to make some more progress.

Pete



Posted on Dec 10, 2009, 6:40 PM

Respond to this message   

Return to Index

Response TitleAuthor and Date
I tried the DO LOOP and got somewhere--sort ofJP on Dec 10
 I'm going to put this assignment to bed...Pete on Dec 10
  Its better, but not quite there still...JP on Dec 10
   You just had a couple more things to address...Pete on Dec 10
    YayJP on Dec 10
     * You're welcome. I hope what you learned here makes the next assignment a little easier.Pete on Dec 10

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement