c_wiley

c_wiley

  • NA
  • 57
  • 0

If operators

Oct 23 2003 12:11 PM
Ok I think I know the answer to this but I am going to ask anyway, I an still very new to c#. Is there any way to put an or operator into an if statement: If (lcAge == 21 or lcAge == 22) Or does it have to be: If(lcAge == 21) { } else if(lcAge == 22) { } if it has to be the latter, how do you code get around duplicating code? Do you call functions within the if statements? If(lcAge == 21) { CheckAge(); } else if(lcAge == 22) { CheckAge(); } sorry for the level of question many thanks, Craig

Answers (5)