by gary_0 · 2y ago · 0 comments
import sys; print(sys.executable)
x = 5; # this is fineI felt this way until I engaged in code with very horizontal coding styles. Semicolons make it extremely easy to visually break up sequential statements from expressions consuming multiple lines.
I'm not sure what you mean. Could you give an example?
var list = obj.FindDataNear(a, b...).Select(i => obj.GetPosition(i))
.Where(...long lambda...)
.MoreLINQ()
.ToList();
So with the style I used, the semicolon is superfluous due to indentation. Are there styles where the semicolon is useful?If the current line starts on the same line that the previous expression started on, then a semicolon is inserted at the beginning of the current line. There are also some messy rules about opening and closing braces being inserted.
So, this:
do expr1
expr2
do expr3
expr4
Ends up being parsed as though it were written like this: do { expr1
; expr2
do { expr3
; expr4
}
}
If the next line is indented, it's just taken as a continuation of the previous line's expression, so nothing needs to happen. for x in *.txt; do echo $x; done
for x in *.txt
do
echo $x
done