Logical operators

What is the difference between (x<=y) and ((x<y)||(x=y))??

The first reads,

x less than or equal to y

The second reads

x less than y OR x equal to y

however the latter is an invalid comparison.

x < y || x == y

Written in the correct form there is no difference, per se, but the simple comparison is preferrable for readability and debugging of the logic.

1 Like