5
Answers

If operators

Ask a question
c_wiley

c_wiley

20y
3.4k
1
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)