*puts on my nerdy nasaly voice* I hope that was sarcasm.
I do a LOT of single lines after if statements all the time, like this:if (colour == red){print red;}else{print blue;}And I'm not one of those tards who doesn't put curly braces around single statements.Defending the lack of curly braces in python, is like defending the lack of differentiating setting a value vs comparing a value (using = to compare values in an if statement). If that's how you learn, you're going to have to change your coding ways to use any other language.Curly braces make it easier to visually identify, but also makes it easier to problematically identify, which if you happen to be a text editor, makes it much easier for you to do things like allow a developer to jump to-and-from the opening and closing curly brace if there is a lot of statements between them. The notion of literally relying on whitespace is ridiculous, and annoying.
Note that I am not saying indentation instead of curly brackets is better, I am saying that it makes perfect sense.
Quote:
if (colour == red){print red;}else{print blue;}
MY EYESThe point of curly brackets is mainly to create blocks of code. While I agree on visually identification and that it's a good argument, using them on the same line as the code makes very little sense in almost all ways. First of all, it's kind of inconsistent. Second of all, once you add code to the block, you most likely do something like:
{
print red;
print 'is awesome';
}
Wouldn't you at that point think something like "why didn't I do it like so in the first place-"
I'm with sXc on this; I understand in-line and coding with no spacing to prevent others from editing your code when you're distributing it as a finished product, but while you're editing it, it's best to keep as much clutter out of the way as possible.
As long as you're not saying indentation should replace curly braces, it's all good. =D
If I were to add more lines of code, I would break it into a 4+ line of code, instead of 1, but do still prefer to write most of my single line blocks as a single line.
1) The number of consistent IF statements suggests that you may want to make another script to handle particular conditions, or use an orderly 2D-array.2) Use semicolons for this situation as good practice: variable = x; variable2 = x[10];Functions you can, but are not required. If you try and obfuscate that code, it will not work without semicolons after assigning values.3) Indent your code, and dont listen to FSX. Listen to Rob's comment [#45]. Easy to read and is what most people agree on.Your naming style is good. other scripts seem reasonable. Doesnt seem to bad to work with
*puts on my nerdy nasaly voice* I hope that was sarcasm.
I do a LOT of single lines after if statements all the time, like this:if (colour == red){print red;}else{print blue;}And I'm not one of those tards who doesn't put curly braces around single statements.Defending the lack of curly braces in python, is like defending the lack of differentiating setting a value vs comparing a value (using = to compare values in an if statement). If that's how you learn, you're going to have to change your coding ways to use any other language.Curly braces make it easier to visually identify, but also makes it easier to problematically identify, which if you happen to be a text editor, makes it much easier for you to do things like allow a developer to jump to-and-from the opening and closing curly brace if there is a lot of statements between them. The notion of literally relying on whitespace is ridiculous, and annoying.Note that I am not saying indentation instead of curly brackets is better, I am saying that it makes perfect sense.
I'm with sXc on this; I understand in-line and coding with no spacing to prevent others from editing your code when you're distributing it as a finished product, but while you're editing it, it's best to keep as much clutter out of the way as possible.
As long as you're not saying indentation should replace curly braces, it's all good. =D
If I were to add more lines of code, I would break it into a 4+ line of code, instead of 1, but do still prefer to write most of my single line blocks as a single line.Then why not just do it like
I…Er…
stfu Rob, no one likes you. My argument still stands.(to the first half of your comment)What do I see here:
1) The number of consistent IF statements suggests that you may want to make another script to handle particular conditions, or use an orderly 2D-array.2) Use semicolons for this situation as good practice: variable = x; variable2 = x[10];Functions you can, but are not required. If you try and obfuscate that code, it will not work without semicolons after assigning values.3) Indent your code, and dont listen to FSX. Listen to Rob's comment [#45]. Easy to read and is what most people agree on.Your naming style is good. other scripts seem reasonable. Doesnt seem to bad to work withThe code's not as bad as people say. Nobody here knows code that's so far from standards unless they've seen stuff Serprex coded.
I AM NOT SAYING NOT TO INDENT CODE. I'M SAYING I HATE PYTHON.