A lot of time we have seen problems where we need to output a YES or No. Usual way of doing this is flag ? "YES" : "NO"
however many programming language supports directly printing boolean as True
or False
.
So is there any specific reason we are asked to print YES/NO instead TRUE/FALSE?
Here is a simple diff between both approach:
System.out.println(flag? "YES" : "NO" );
vs
System.out.println(flag);