this post was submitted on 17 Jun 2023
150 points (98.7% liked)

Programmer Humor

32032 readers
1263 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] salimundo 1 points 1 year ago (1 children)

Why isn't the else curly lined up with the end of the else word? I'd your gonna go crazy might as well go all the way I guess ๐Ÿ˜œ

[โ€“] [email protected] 1 points 1 year ago

The { of the else is just the 2nd, optional, part of the if statement, so I was learned to align it with the opening keyword. I do the same with the then keyword, when the language requires a then, then it's aligned with the i if if an the { with the f of if.

In the old days, when memory was expensive (in the day of 4k computers), even an extra cr/lf was worth preventing. Hence C has no then, C layout is usually { .... } for one liners... or even without the { },... I learned to program in the IT dark ages. ;)