Announcement

Collapse
No announcement yet.

Select Case with AND ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bern Ertl
    replied
    If X / Grade are LONG variables, you should use SELECT CASE AS LONG ...

    Leave a comment:


  • José Roca
    replied
    No with that syntax, but you can use:

    Code:
       Select Case X
    
        Case 71 TO 99
    
            Res$="PASS! Congratulations!!
    
        Case 1 TO 70
    
            Res$="FLUNKO! Go to teacher for punishment!"
    
        Case < 1
    
            Res$="Report to office. You are being sent back a grade."
    
       End Select

    Leave a comment:


  • Robert E. Carneal
    started a topic Select Case with AND ?

    Select Case with AND ?

    I am aware that I can do this:

    I am going to be a plain about this for clarity.
    (Assume Grade = 8)

    I know I can do this:
    Select Case Grade
    Case 2, 4, 6, 8
    Res$="EVEN"
    Case 1, 3, 5, 7
    Res$="ODD"
    End select
    Print Res$
    End


    That is, when a CASE clause contains multiple tests separated by commas, the logical OR is performed. Question: Can I make a SELECT CASE statement using the logical AND?? I.e., can I do this:?
    Assume X = 75

    Select Case X
    Case >70, AND <100
    Res$="PASS! Congratulations!!
    Case >0, AND < 71
    Res$="FLUNKO! Go to teacher for punishment!"
    Case < 1
    Res$="Report to office. You are being sent back a grade."
    End Select
    Print Res$


    Is that possible?

    Thank you.

    Robert
Working...
X