logical operator

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
How would I compare a string to multiple values, ie. do this same action if
string "abc" is equal to string X, or string Y or string Z? I know I can do
it in three nested if-else statement, but is there a smarter way?

TIA
--
 
How would I compare a string to multiple values, ie. do this same action if
string "abc" is equal to string X, or string Y or string Z? I know I can do
it in three nested if-else statement, but is there a smarter way?

stirng s = "abc";
if ( s == X || s == Y || s == Z ) ...



Mattias
 
Back
Top