0

Can I have multiple conditions for a single if statement?

for example, I want to have a program where the person enters their birth month, date and year. I want an if-statement where if the month is <=12, date is <=31 and year is <=2016 it executes a code, but if else it produces an error message. I can't figure out how to make it all one if statement, do I have to use nested if statements for it to work? seems way too complicated that way. Thanks!

10th Oct 2016, 8:12 AM
Tyler JoAnn Weidman
Tyler JoAnn Weidman - avatar
1 Odpowiedź
+ 4
you can simply use && to link multiple statements. put in pseudo: if ( day <= 31 && month <= 12 && year <= 2016) && is not the only operator I'd recommend reading a short guide on Logical Operators ;)
10th Oct 2016, 8:15 AM
Grennith