In mathematics, the notation 18 < age < 30 denotes that age must lie between the values 18 and 30. Is it possible to use this kind of notation in the if statement? For example, I’ve tried executing
if(18 < age < 30)
and I get weird output, so it’s not quite right. Is there a way to do this or so I simply have to write
if(age > 18) /*blah*/;
else if(age < 30) /*same blah*/;
You can do: