[futurebasic] RE: [FB] CASE Question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1999 : Group Archive : Group : All Groups

From: Chris.Young@...
Date: Fri, 12 Nov 1999 08:51:42 -0600
CASE must be used in the constructs of the SELECT... END SELECT 
statements. In your example below, you could change it to:

dim i,j
 
for i=1 to 4
  for j=1 to 4
    SELECT
    case ((i = 3) and (j = 3) )
       print "Hit!"
    case else
       ' do nothing
    END SELECT
  next
next

hth

Chris Young

On Thursday, November 11, 1999 8:53 PM, stharris@... 
[SMTP:stharris@...] wrote:
> The following use of a CASE statement doesn’t work.
> 
> dim i,j
> 
> for i=1 to 4
> for j=1 to 4
> case ((i = 3) and (j = 3) )
> print "Hit!"
> next
> next
> 
> Error: SELECT structure error in CASE
> In file Temp Project at line 18 in Main Program, Code=129448
> •case• ((i = 1) and (j = 2) )
> '~'
> ********* End of PPC Code Compile *********
> ************* End of Compile **************
>  Warnings: 0
>    Errors: 1
> **************************
> I kept adding parens to the CASE statement to try to get to see a 
single
> yes or no, but it didn’t work.
> 
> Is there a way that a CASE statement can be used with any arrangement 
of
> Boolean or logical statements to replace an IF statement such as:
> 
> LONG IF x <= 15 AND x >= 100
>   Do something
> END IF
> ??
> 
> I have a situation with two rows of 15 buttons, one button being set 
in
> each row; and three control buttons. The control buttons work nicely
> with the CASE statement, but I have had to go to two LONG IF/END IF
> statements for the single button in each row. This only offends my 
sense
> of symmetry. It would give me great satisfaction to avoid such a 
hybrid
> approach
> 
> 
> --
> To unsubscribe, send ANY message to 
<futurebasic-unsubscribe@...>
> 
>  << File: [FB] CASE Question.TXT >>