Elektrine lite

← Feed

@cows_are_underrated@feddit.org

2026-10-09 18:22 UTC

The reason I dislike the missing of semicolons and brackets is because it causes bugs (that’s more of a problem of missing braces to declare the scope of your code) and also takes away control from the programmer. Missing braces: I had more than one instance where I accidentally deleted the intendation in a python script that caused undefined behaviour in my code and it took quite a lot of time to track that down. If the programming language would have forced me to properly defined the scope of my code by introducing brackets, that bug would have never been possible. Semicolons: The main thing I like about semicolons is that it allows you to properly space out your code over multiple lines for visual clarity. E.g.: void my_function(int arg1, int arg2, int arg3){ //some code } int main(){ my_function( 1, //arg1 3, //arg2 8 //arg3 ) } Rust even allows you to leave out the semicolon on the last statement of a code scope in order to return the result of the statement: fn main() { let condition = true; let number = if condition { 5 } else { 6 }; //number turns into 5 println!("The value of number is: {number}"); } }

Replies (0)

No replies.