r/shittyprogramming • • Apr 23 '19

Space efficient & lines up nicely

Post image
521 Upvotes

58 comments sorted by

View all comments

Show parent comment

6

u/dmitriy_shmilo Apr 23 '19

Now do ‘else’.

4

u/[deleted] Apr 23 '19

The semicolon shows the end of the statement so there's no ambiguity. ;)

{

} if (x);
{

} else;

10

u/dmitriy_shmilo Apr 23 '19

And you don’t see anything wrong with this?

4

u/[deleted] Apr 23 '19

Nope.

1

u/TeamKKKone Jun 30 '19

Maybe this?

{ ... } if (x) else { ... }

3

u/Scyntrus Apr 24 '19

Python already has "y if x else z"