If operators
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

jamesRank #1,153 · 1.6K reputationPosted Oct 23, 2003, 8:15 AM EDT
buchholz60 reputationPosted Oct 23, 2003, 8:22 AM EDT
katanaRank #7,224 · 246 reputationPosted Oct 23, 2003, 1:34 PM EDT
c_wiley73 reputationPosted Oct 24, 2003, 12:36 AM EDT
david 0Rank #8,108 · 228 reputationPosted Oct 24, 2003, 3:34 AM EDT