Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to make and if statement where 2 choices apply. if ontarioName = "ontario" or "Ontario".
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
pcmang




PostPosted: Sat Jan 17, 2009 1:30 pm   Post subject: How to make and if statement where 2 choices apply. if ontarioName = "ontario" or "Ontario".

when i type if ontarioName = "ontario" or "Ontario" then...
i get an error.
Sponsor
Sponsor
Sponsor
sponsor
DanielG




PostPosted: Sat Jan 17, 2009 1:32 pm   Post subject: RE:How to make and if statement where 2 choices apply. if ontarioName = "ontario" or "Ontario".

well, if you only want it to work regardless of lower or uppercase then you can convert it to lower or upper case in the if statement (I believe turing has a built in function for that). However, if you want it to work just for these 2 cases then you need

code:

if ontarioName = "ontario" or ontarioName = "Ontario then
pcmang




PostPosted: Sat Jan 17, 2009 2:07 pm   Post subject: Re: How to make and if statement where 2 choices apply. if ontarioName = "ontario" or "Ontario".

Thanks. That helped.
[Gandalf]




PostPosted: Sun Jan 18, 2009 6:54 am   Post subject: RE:How to make and if statement where 2 choices apply. if ontarioName = "ontario" or "Ontario".

Alternatively, you could condense your if statement into:
code:
if Str.Lower(ontarioName) = "ontario" then
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: