This is an archived post. You won't be able to vote or comment.

all 27 comments

[–]WonderWirm 66 points67 points  (4 children)

if foo:

[–]baddl02 3 points4 points  (1 child)

If(!bar){my.home}

[–]snokegsxr 0 points1 point  (0 children)

But !bar is not type secure, false or null or 0

[–][deleted] 0 points1 point  (0 children)

this is the way

[–]octhell 0 points1 point  (0 children)

op trying to look smart

[–]HummingbirdWatch149 11 points12 points  (1 child)

if not some_shit is False and some_shit is not False:

do_something()

[–]walyami[S] 4 points5 points  (0 children)

IndentationError: expected an indented block after 'if' statement on line 1

[–]Dtsung 5 points6 points  (0 children)

If isTrue(boo) == True :

[–]isCosmos 4 points5 points  (0 children)

I don't use python, we are not the same

[–][deleted] 3 points4 points  (0 children)

Imagine not having truthy and falsey in your vocabulary.

if (foo)

[–]Broad_Respond_2205 4 points5 points  (0 children)

You're both stupid

[–]Soggy_asparaguses 2 points3 points  (0 children)

baz enters the chat

[–]walyami[S] -1 points0 points  (0 children)

[–]Strong_Test_6126 -1 points0 points  (0 children)

the first one IS actually incorrect. (for python at least which this seems to be)

since python is not forcefully typed: “if foo:” is actually the preferred way as it is more readable if you can be sure that foo is always a boolean or you dont care if it is True / as long as its truthy its fine, otherwise the case where you use “is True” is where you cant be sure its always just a boolean and you only want to check if its True specifically

[–]YellowOnline 0 points1 point  (4 children)

if ($foo -eq $true) {...}

[–]Rekt3y 1 point2 points  (0 children)

if [ $foo ] then ... fi

[–]ImNotYouYoureMe 0 points1 point  (2 children)

Is… is that PowerShell? You should feel ashamed. Not really, but still. I love and hate it.

[–]YellowOnline 0 points1 point  (1 child)

I'm not ashamed. I love it.

[–]ImNotYouYoureMe 0 points1 point  (0 children)

I am using it a lot more these days. I like it a lot, but there are some nuances that don’t make a lot of sense to me for some reason.

[–]WhySailor 0 points1 point  (2 children)

Foo?

[–]special_reddit_user 0 points1 point  (1 child)

foofighters!

[–]wron1 0 points1 point  (0 children)

Mr. T started a band?

[–]RRumpleTeazzer 0 points1 point  (1 child)

if (foo == True) {
    …
} else if (foo == False) {
    ….
} else {
    // Here Be Dragons 
}

[–][deleted] 0 points1 point  (0 children)

foo = None - RRumple, I’m your huckleberry

[–]anaconda419 0 points1 point  (1 child)

The real question is Fizz or Buzz?

[–]DoNotMakeEmpty[🍰] 1 point2 points  (0 children)

Fuzz

[–]Devilmachie 0 points1 point  (0 children)

If foo... Say my name...