Where does that else clause even set in? It’s he lower if, isn’t it?
Yep it’s really
if(nested()) {
if(stillNesting()) {
for(int count = 0; count < nestAmount; count++)
for(int dex = 0; dex < nestAmount * 2; dex++)
initMindExplosion(fetalPosition);
} else {
whenWillIdoIt();
}
}
Since you’re all already thoroughly derailed, what do you say about braceless, whitespace-sensitive languages? (e.g. python, nim)
if(nested())
{
if(stillNesting())
{
for(int count = 0; count < nestAmount; count++)
{
for(int dex = 0; dex < nestAmount * 2; dex++)
{
initMindExplosion(fetalPosition);
}
}
}
else
{
whenWillIdoIt();
}
}
Much better There is much happiness in the braces aligning up
What happens when I use a mix of tabs and spaces?
Errors.
But how easy are they to detect and fix?
I do python lately because we move our IT automation over to ansible and didn’t like it at first. But after needing to write some of the automation stuff in java with heavy json modification, I was bewildered how awful it felt compared to the ease it was with python.
Regarding tabs and spaces. Just make sure you follow PEP 8 style guide for python and switch you IDE to show whitespaces (which is default for me anyways)
Try Closure if you want to retain some Java sanity.
Cas
python is insane. no brackets and forcing you to do this indentation exactly how it expects it.
also no semicolons. heresy.
Something I learned in programming when I was very very young was “white spaces are ignored by the compiler”.
I realize this is evidently, like I just mentioned python, not true for every language. But I always treated it like a holy rule.
I can write the whole program in one line, or 4 commands in one line IF I CHOOSE TO.
Of course there are big arguments FOR this, saying, limiting what the programmer can actually do / is allowed to do limits the amount of mistakes he can do and resulting errors. Also LINT and such
and I dont disagree
but i still hate it.
Whats the fun in having rules if its impossible to break them ?
Implying programming is fun to begin with. Irony