Qbasicnews.com
April 03, 2020, 07:06:36 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Another select case question  (Read 1715 times)
jgr
Forum Regular
**
Posts: 131


« on: March 24, 2004, 11:24:52 AM »

can you have a multiple condition case??

I know this is in error but how can you do it in  select case


ex.

input answer

select case answer
             case 0
                        ............
             case 1
                        ............
             case is >1 and <5
                        .............
             case 6
                        .............
end select
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #1 on: March 24, 2004, 12:27:09 PM »

"CASE IS" can only be used with 1 condition:

Code:
CASE IS>=10


What you want to do can be achieved this way:

Code:
CASE 1 TO 5


Will be true if the variable is >=1 and <=5.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
red_Marvin
Na_th_an
*****
Posts: 1509



WWW
« Reply #2 on: March 24, 2004, 01:12:09 PM »

BTW (this isn't worth starting a new topic for)

What's the difference between "CASE 5" and "CASE IS = 5"?

[/hijacking topic]
Logged

/post]
R@dioman
Ancient QBer
****
Posts: 410



« Reply #3 on: March 24, 2004, 06:43:02 PM »

nothing
Logged

R@dioman
Ancient QBer
****
Posts: 410



« Reply #4 on: March 24, 2004, 06:43:35 PM »

nothing
Logged

whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #5 on: March 24, 2004, 06:50:30 PM »

Quote from: "R@dioman"
nothing

you sure? i tested the speed and CASE 5 is faster (i think)
Code:
CLS
a = 5
t = TIMER
FOR i = 1 TO 10000
SELECT CASE a
CASE IS = 5: LOCATE 1, 1: PRINT 1
END SELECT
NEXT
PRINT TIMER - t
SLEEP
t = TIMER
FOR i = 1 TO 10000
SELECT CASE a
CASE 5: LOCATE 3, 1: PRINT 2
END SELECT
NEXT
PRINT TIMER - t
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #6 on: March 24, 2004, 07:16:45 PM »

case 5 is faster to type.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!