0

What is the difference between

if (false == <condition>)

and

if (!<condition>)

and

unless (<condition>)


What is the difference between

while (false == <condition>)

and

while (!<condition>)

and

until (<condition>)


Why isn't unless and until in all programming languages?

Thank you for your help.

1 Answers1

0
if (false == <condition>)

and

if (!<condition>)

and

unless (<condition>)

Logically, they are all equivalent.

Likewise:

while (false == <condition>)

and

while (!<condition>)

and

until (<condition>)

Logically they are equivalent. Except syntactically, until() might be used at the end of a loop and while() at the beginning of a loop.

Although logically they are equivalent, some programming languages provide them (unless, until) for readability.

And you might want to take a look of this to trace back their first usage in programming language.

Paul Wang
  • 1,666
  • 1
  • 12
  • 19