Bool - with AM and PM

Hi Guys :)

I am running an example from book and something is puzzling me. I don't understand why code behaves in such way:

 
bool pm = hours < 12 ? false : true; // find am/pm  


I have entered hours as 22, after executing of this line pm flag is changed to TRUE in debugger.

My understanding (well I don't understand the line exactly I think this is the issue)
is as far

choice bool (true or false) PM will be true if hours is smaller then 12, or false when is bigger then 12.

But it appears its the opposite.

where I could read about this < 12 ? false : true; or if someone have time to explain how to read/understand this syntax I would much appreciate :)

thank you :)
Keskiverto - thank you!!

That was one excellent explanation.

why I am not correct in reading that if hours is less then 12 it should be false??? :D

hours = 22
PM (hours) is bigger then 12 so it should be read as False????
Topic archived. No new replies allowed.