Reputation: 131
I need to improve this statement by either correcting it or making it shorter
if (0 <= age <= 100) // age is between 0 and 100)
I am totally confused about spending 20 minutes on the question. It seems really simple but the only revision I could think of is
if (0 <= age && age <= 100)
and that doesn't seem right. Am I just missing something obvious? Can someone help me please?
Thanks
Upvotes: 4
Views: 134
Reputation: 471379
Your revision is correct. if (0 <= age && age <= 100)
is the correct way to do it. There really isn't a simpler way.
Upvotes: 7