why is the operands in the if statement when not equal evaluates to true...

i thought that it should be evaluated to false. when it is not equal

27th Jul 2016, 6:57 AM
stephen haokip
stephen haokip - avatar
2 Answers
The value within the condition braces shud evaluate to a boolean 1 to continue. That is irrespective of what you use within the conditions
27th Jul 2016, 7:04 AM
chaitanya guruprasad
chaitanya guruprasad - avatar
Actually the expression should evaluate to a non-zero value for the if block to be executed. Otherwise the else block, if any, is executed. Non-zero does not necessarily mean 1: 2, -5, etc... will do.
9th Nov 2016, 8:01 AM
Giulio Pellitta
Giulio Pellitta - avatar