Shop OBEX P1 Docs P2 Docs Learn Events
Conditional case using strings — Parallax Forums

Conditional case using strings

Bobb FwedBobb Fwed Posts: 1,119
edited 2013-04-29 14:00 in Propeller 1
I'm guessing there is no way to use a conditional case statement with strings?
I'll have to use an ELSEIF tree I assume.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-04-29 13:59
    case works with strings:
    PUB process(command)
    
      case true
    
        strcomp(command, string("File")): 'Do File stuff.
    
        strcomp(command, string("Edit")): 'Do Edit stuff.
    
        strcomp(command, string("Run")):  'Do Run stuff.
    

    -Phil
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2013-04-29 14:00
    Ah. Thank you.
Sign In or Register to comment.