Jump to content

Am I the only one who prefer the explicit condition syntax?

as96

I mean I prefer writing:

if(lol == false){ }

instead of:

if(!lol){ }

Am I weird?

Link to comment
Share on other sites

Link to post
Share on other sites

snip

 

There's several ways to do the same thing in code so nahh bruh you good. I use a mix of them tbh. Especially in PHP where I have to use === to detect function errors (file_get_contents not being able to open the file etc) because the devs haven't heard of a try-catch sad.png

Speedtests

WiFi - 7ms, 22Mb down, 10Mb up

Ethernet - 6ms, 47.5Mb down, 9.7Mb up

 

Rigs

Spoiler

 Type            Desktop

 OS              Windows 10 Pro

 CPU             i5-4430S

 RAM             8GB CORSAIR XMS3 (2x4gb)

 Cooler          LC Power LC-CC-97 65W

 Motherboard     ASUS H81M-PLUS

 GPU             GeForce GTX 1060

 Storage         120GB Sandisk SSD (boot), 750GB Seagate 2.5" (storage), 500GB Seagate 2.5" SSHD (cache)

 

Spoiler

Type            Server

OS              Ubuntu 14.04 LTS

CPU             Core 2 Duo E6320

RAM             2GB Non-ECC

Motherboard     ASUS P5VD2-MX SE

Storage         RAID 1: 250GB WD Blue and Seagate Barracuda

Uses            Webserver, NAS, Mediaserver, Database Server

 

Quotes of Fame

On 8/27/2015 at 10:09 AM, Drixen said:

Linus is light years ahead a lot of other YouTubers, he isn't just an average YouTuber.. he's legitimately, legit.

On 10/11/2015 at 11:36 AM, Geralt said:

When something is worth doing, it's worth overdoing.

On 6/22/2016 at 10:05 AM, trag1c said:

It's completely blown out of proportion. Also if you're the least bit worried about data gathering then you should go live in a cave a 1000Km from the nearest establishment simply because every device and every entity gathers information these days. In the current era privacy is just fallacy and nothing more.

 

Link to comment
Share on other sites

Link to post
Share on other sites

i actually rarely use booleans, if i encounter stuff like this, its usually catching the return of a function.

Link to comment
Share on other sites

Link to post
Share on other sites

I prefer the implicit way, because simply its faster to write :'D

 

also i prefer

if (!lol){   code;}

to 

if (!lol){code;}

"Unofficially Official" Leading Scientific Research and Development Officer of the Official Star Citizen LTT Conglomerate | Reaper Squad, Idris Captain | 1x Aurora LN


Game developer, AI researcher, Developing the UOLTT mobile apps


G SIX [My Mac Pro G5 CaseMod Thread]

Link to comment
Share on other sites

Link to post
Share on other sites

It is overly complicated IMO and is also slightly less efficient in terms of computing power IIRC, although that won`t ever make a real world difference.

GPU: Gigabyte GTX 970 G1 Gaming CPU: i5-4570 RAM: 2x4gb Crucial Ballistix Sport 1600Mhz Motherboard: ASRock Z87 Extreme3 PSU: EVGA GS 650 CPU cooler: Be quiet! Shadow Rock 2 Case: Define R5 Storage: Crucial MX100 512GB
Link to comment
Share on other sites

Link to post
Share on other sites

Explicit makes it more easy to read and if I prefer using it when explaining stuff to total beginners who are seeing an if-else statement for the first time.  :lol:

Most of the time I go for the implicit way because it saves some typing. (is this the way it's called?)

From salty to bath salty in 2.9 seconds

 

Link to comment
Share on other sites

Link to post
Share on other sites

It's the same thing, but why type 12 characters when 4 will do?

 

also, !lol can also mean lol does not exist yet, whereas the implicit comparison will give out error if it can't find the value of lol. Depending on what you're doing it may be a problem.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

Out in the real world the common mentality is to face palm when one encounters explicit evaluations...

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

Everyone has their own preferences for how they write code. The most important thing is to be consistent across the whole project. If you are working with/for other people, everyone should be following the same guidelines and you may not get to do everything the way you prefer. What you decide to do in your own personal projects is up to you.

Link to comment
Share on other sites

Link to post
Share on other sites

I prefer implicit. It's nicer looking, makes the code easier to traverse, and it allows you to much more easily hit those 80 character line limits. That being said though, I'm not going to really complain about being explicit if being implicit would be against the style guide; consistency is much more important.

 

 

also i prefer

if (!lol){   code;}

 

No space between the conditional and the open curly brace? You heretic!  :o

"Unix was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." - Doug Gwyn

Link to comment
Share on other sites

Link to post
Share on other sites

I prefer implicit. It's nicer looking, makes the code easier to traverse, and it allows you to much more easily hit those 80 character line limits. That being said though, I'm not going to really complain about being explicit if being implicit would be against the style guide; consistency is much more important.

 

 

No space between the conditional and the open curly brace? You heretic!  :o

 

Oh no don't get me started on the brace positioning because I hate all of them so far. It's Allman or it can go to hell as far as I am concerned. Sod consistency because if I see the other in anything other than JavaScript I change the consistent style.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

Honestly it doesn't matter how you code, unless you're at a business. In that case, you must write your code based on their syntax. 

Link to comment
Share on other sites

Link to post
Share on other sites

Honestly it doesn't matter how you code, unless you're at a business. In that case, you must write your code based on their syntax. 

When I work with other people I adapt to their syntax, but I'm talking about a personal preference on my own stuff.

Link to comment
Share on other sites

Link to post
Share on other sites

I prefer to be verbose when i know a beginner is going to be reading the code, but all other times my IDE bitches at me so i use the shorthand.. 

CPU: i7 4770k | GPU: Sapphire 290 Tri-X OC | RAM: Corsair Vengeance LP 2x8GB | MTB: GA-Z87X-UD5HCOOLER: Noctua NH-D14 | PSU: Corsair 760i | CASE: Corsair 550D | DISPLAY:  BenQ XL2420TE


Firestrike scores - Graphics: 10781 Physics: 9448 Combined: 4289


"Nvidia, Fuck you" - Linus Torvald

Link to comment
Share on other sites

Link to post
Share on other sites

It is overly complicated IMO and is also slightly less efficient in terms of computing power IIRC, although that won`t ever make a real world difference.

Both formats will perform the same way, IIRC. The compiler will optimize it in a way that they end up having the same underlying bytecode. 

 

I prefer implicit because after a while of programming you get used to seeing it and the logic is just as clear as the explicit form. 

Link to comment
Share on other sites

Link to post
Share on other sites

So how far do you take the explicit comparison?

if ((lol == true || lmao == true || rofl == true) == true) {}if ((a < b) == false) {}if ((i%2 == 0) == true) {}
Link to comment
Share on other sites

Link to post
Share on other sites

Both formats will perform the same way, IIRC. The compiler will optimize it in a way that they end up having the same underlying bytecode.

Depends on the language and compiler of course. 

Doing 

s = Falseif s == False:    print(1)

in Python will be slower than doing

s = Falseif not s:    print(1)

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

 

So how far do you take the explicit comparison?

Usually over 2 conditions I use implicit.

 

I know I'm weird...

Link to comment
Share on other sites

Link to post
Share on other sites

Usually over 2 conditions I use implicit.

 

I know I'm weird...

 

Now you're just being inconsistent :P

Link to comment
Share on other sites

Link to post
Share on other sites

When I work with other people I adapt to their syntax, but I'm talking about a personal preference on my own stuff.

I know, that's why the first 6 words of my sentence say it doesn't matter.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×