MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1v5hwu7/javascript_without_braces/
r/programminghorror • u/my_new_accoun1 • Jul 24 '26
(technically typescript)
12 comments sorted by
14
Oddly enough, I don't hate it as I can actually read and follow it. Much more would be too much, but I like how it's broken up by the if/elseif/else at least.
4 u/my_new_accoun1 Jul 24 '26 yeah but there only problem (as I later realised) is that without the braces JavaScript doesn't know where the elseif/else is supposed to beso I ended up not being able to use this masterpiece
4
yeah but there only problem (as I later realised) is that without the braces JavaScript doesn't know where the elseif/else is supposed to be
so I ended up not being able to use this masterpiece
40
One can write it without if statements too.
if
if (something === true) { suspect.hit = 'found'; chain(); reaction(); } else doOtherThings(); // the same .. (something) && (suspect.hit = 'found', chain(), reaction()) || (doOtherThings());
7 u/oweiler Jul 28 '26 Thanks, I hate it 3 u/Nooo00B Jul 29 '26 this is just cursed → More replies (1)
7
Thanks, I hate it
3
this is just cursed
34
Thank god we have auto eslint on save at work
9
Still more readable than regular Python.
7 u/Yarhj Jul 25 '26 The fact that python made whitespace load-bearing but did not even enforce file-level whitespace consistency is absolutely absurd to me.Also tabs are objectively better than spaces and I will die on this hill.
The fact that python made whitespace load-bearing but did not even enforce file-level whitespace consistency is absolutely absurd to me.
Also tabs are objectively better than spaces and I will die on this hill.
2
Try imagining reading your code in 5 years. Which syntax is easiest to understand?
My pick would be the if statement.
Writing software is not about showing your creativity with syntax, but maintainable code imho
2 u/Tux-Lector Jul 26 '26 (something) && ( suspect.hit = 'found' , chain() , reaction() ) || ( doOtherThings() );
(something) && ( suspect.hit = 'found' , chain() , reaction() ) || ( doOtherThings() );
1
Pyscript
14
u/fakehalo Jul 24 '26
Oddly enough, I don't hate it as I can actually read and follow it. Much more would be too much, but I like how it's broken up by the if/elseif/else at least.
40
u/Tux-Lector Jul 24 '26
One can write it without
ifstatements too.34
u/Mark__78L Jul 24 '26
Thank god we have auto eslint on save at work
9
u/DT-Sodium Jul 24 '26
Still more readable than regular Python.
2
u/wvd_vegt Jul 25 '26
Try imagining reading your code in 5 years. Which syntax is easiest to understand?
My pick would be the if statement.
Writing software is not about showing your creativity with syntax, but maintainable code imho
1
u/Kadabrium Jul 25 '26
Pyscript