₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,347,186 members, 8,527,106 topics. Date: Monday, 30 November 2026 at 07:01 AM

Toggle theme

Yoda Condition? - Programming - Nairaland

Nairaland Forum › Science/Technology › Programming › Yoda Condition? (428 Views)

1 Reply

Yoda Condition? by Karleb(op): 4:20pm On Jan 08, 2021
You might have probably seen something like this before now.

if (5 == $five);

It's called Yoda condition, you check the reverse.

I see this a lot in PHP codes and there are arguments as to why it is better than the normal comparison.

Personally, I don't like it.

Is it really necessary?
Re: Yoda Condition? by etoluw: 9:43am On Jan 09, 2021
Karleb:
You might have probably seen something like this before now.

if (5 == $five);

It's called Yoda condition, you check the reverse.

I see this a lot in PHP codes and there are arguments as to why it is better than the normal comparison.

Personally, I don't like it.

Is it really necessary?
it helps to avoid a bug where you mistakenly type "=" instead of "=="
Re: Yoda Condition? by The5DME(m): 2:20pm On Jan 26, 2021
Karleb:
You might have probably seen something like this before now.

if (5 == $five);

It's called Yoda condition, you check the reverse.

I see this a lot in PHP codes and there are arguments as to why it is better than the normal comparison.

Personally, I don't like it.

Is it really necessary?
check your mail.
1 Reply

• 2 • 3 • 4

How To Record Any Audio On Mac With Audio Recording Software • Everything To Know About Car Rental App In 2021- Benefits & Essential Features • Magento Ecommerce Website Development Tips Given By Experts