Re:Avoid Else, Return Early (2013)
by jonny_eh on Monday March 26, 2018 @01:09PM
(#16680495)
How does an IDE know if a given line belongs in an if block or not?
[ Parent
| on HN ]
Re:Avoid Else, Return Early (2013)
by true_religion on Tuesday March 27, 2018 @12:21AM
(#16685211)
It'll indent up to the most relevant valid block as possible, given your cursor at the moment. If you click within an if block, it'll indent into that if-block.
The indentation strategy also looks to produce syntactically valid code, so long as what you are pasting lacked indentation errors.