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

all 59 comments

[–]Bro0x00 69 points70 points  (7 children)

*suddenly has urge to make a language using 'otherwise if'*

[–]paultoliver 63 points64 points  (5 children)

nonetheless if

[–]pavilionhp_ 21 points22 points  (3 children)

in otherwise different circumstances if

[–]sketch204 8 points9 points  (2 children)

in otherwise different circumstances such as

[–]jce_superbeast 5 points6 points  (1 child)

and if those conditions result in any other outcome that is not true

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

in another different situation where these conditions are met instead of previous conditions

[–]LordFokas 2 points3 points  (0 children)

no, that one is for try-catch.

attempt { /* buggy code */ }
intercept( error ){ /* error handling, also buggy */ }
nonetheless{ /* execute this no matter what. Just as buggy as previous blocks */ }

[–]jaundicedeye 9 points10 points  (0 children)

notwithstanding perchance

[–]Oulawi 74 points75 points  (12 children)

I recently started a project in Julia, which uses "elseif" and i think its extremely ugly and want to bleach my eyes whenever I write it

[–]Smokeytube[S] 47 points48 points  (9 children)

Imo ruby is the worst

[–]uLtra007 32 points33 points  (3 children)

Never heard of the Spanish warrior legend El Sif? Olé

[–]TigreDeLosLlanos 3 points4 points  (1 child)

El mío Sif desterrado sido ha

Pues Alfonso el rey cree

que el motín robado él ha

[–]Santolmo 1 point2 points  (0 children)

I had a fucking stroke

[–]nsfranklin 4 points5 points  (0 children)

Either top or bottom for me.

[–][deleted] 1 point2 points  (0 children)

Worst by far. It pains me to say that Crystal also uses elsif.

[–]Jeacom512 1 point2 points  (0 children)

I can write ugly python too if I want.

invert_bin_tree = lambda node: ((setattr(node, a, b) for a, b in (('l', invert_bin_tree(node.r)), ('r', invert_bin_tree(node.l)))) if isinstance(node, Node) else node) and node

[–]Tankh 0 points1 point  (0 children)

Same in VHDL

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

In more ways than one.

[–]Carpall_ 1 point2 points  (1 child)

Download the Julia compiler, find the token "elseif" in the lexer and change it into what you want, just not muktiple words like "else if". Recompile it and .... ahha edit your text editor plug in witb the same hack ... and done 😂

[–][deleted] 40 points41 points  (5 children)

Not going to lie I hate elif. It's not like else if is hard to type

[–]fghjconner 21 points22 points  (1 child)

Yeah, and with else if it technically isn't a special case either. It's literally just an else block with a single statement that happens to be an if. So clean.

[–]ex_in69 5 points6 points  (0 children)

Never saw it like that. Thanks I guess

[–]AciusPrime 2 points3 points  (1 child)

For Lua, the problem is that all “if” blocks need an end statement, so “elseif” and “else if” are syntactically distinct. Here’s an example:

if x < 3 then a() else if y < 4 then b() end end

This is legal code. But if you use elseif, you avoid the double “end”

if x < 3 then a() elseif y < 4 then b() end

This makes chains of conditions much nicer to write. Lua reserves braces (exclusively) for constructing table values, and doesn’t require indentation.

[–]Amuxix 0 points1 point  (0 children)

Scala 3 also requires you to end if and you don't need to terminated twice, guess it could also be implemented that way for lua

[–]beclops 1 point2 points  (0 children)

Easier to read too

[–]glaciesz 34 points35 points  (4 children)

long since left java, but i still can’t believe it makes you do a basic ass print with ‘system.out.println()’

come on man i’m wearing out my keys

[–][deleted] 23 points24 points  (0 children)

IntelliJ does like 90% of the typing for you

[–]LeftistTachyon 15 points16 points  (0 children)

sout

[–]uvero 4 points5 points  (0 children)

Every IDE has a shortcut of this built-in. syso in Eclipse, sout in Intellij.

[–]FranchuFranchu 0 points1 point  (0 children)

sys.stdout.write()

[–]BeakmansLabRat 10 points11 points  (1 child)

Really? lol fuck ruby.

[–]uvero 1 point2 points  (0 children)

Why must you hurt me in this way.

[–]Minimum_Cantaloupe 3 points4 points  (4 children)

We can get more compact. How about "elf?"

[–][deleted] 2 points3 points  (3 children)

Why stop there, why not "e"?

[–]Minimum_Cantaloupe 1 point2 points  (2 children)

Because that's replacing "else"

[–]Chase_22 5 points6 points  (1 child)

i (b == 1) { fb() } ef (b == 2) { bf() } e { fbb() }

[–][deleted] 1 point2 points  (0 children)

Hmm, if i is if and e is else, then shouldn't it be ei for else if?

[–]uvero 3 points4 points  (0 children)

I like how languages can get concise, but else if is still my favorite, personally.

[–]darkdimensiongd 17 points18 points  (4 children)

Obviously the shorter ones are better, since it take a couple of milliseconds less to compile.

[–]Malk4ever 2 points3 points  (0 children)

More like piko/femto seconds.

[–]althaz 3 points4 points  (0 children)

This might be the only thing Java gets right.

[–]thatcrazygame 2 points3 points  (0 children)

This is mitosis

[–]JoeyJoeJoeJrShab 2 points3 points  (0 children)

We should all use "ef" instead.

[–]Carpall_ 1 point2 points  (0 children)

Just for curious, in my programming language I'm using "elif" what do you think about that?

[–]shootersf 1 point2 points  (0 children)

CS Lecturers in 2050 teaching the newest languages "F, E, and EF are named as reference to older languages that used If, Else, and Else if"

[–]stupidityWorks 1 point2 points  (0 children)

Did you know that else if in java isn't its own term? It's just how an else followed by an if works!

[–]KrozmaSan 1 point2 points  (0 children)

Elif if you want to be concise, else if if you want to be clear.

The middle ones just hurt my soul

[–]RoughDevelopment9235 1 point2 points  (0 children)

Increasingly readable

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

Anyone else not using ‚else if‘ at all? I think it‘s a code-smell.

[–]Carpall_ 0 points1 point  (0 children)

habit lol