wonder Expert Licensed User Longtime User Sep 11, 2015 #41 HotShoe said: Many languages allow stacking statements on a single line. I personally never use it simply because it makes the code so much harder to read (for me at least) later on. I rarely even use single line IF statements hehe. --- Jem Click to expand... I have the same kind of approach, it give a more structured appearance to the code. The same goes for my math expressions, regarding the order of operations. Just to be safe, I put parenthesis on everything. For example, "x = A * C / B" becomes "x = ((A * C) / B)". I'm fully aware that in this case it's absolutely redundant, but for more advanced expressions, it really helps keeping everything in place.
HotShoe said: Many languages allow stacking statements on a single line. I personally never use it simply because it makes the code so much harder to read (for me at least) later on. I rarely even use single line IF statements hehe. --- Jem Click to expand... I have the same kind of approach, it give a more structured appearance to the code. The same goes for my math expressions, regarding the order of operations. Just to be safe, I put parenthesis on everything. For example, "x = A * C / B" becomes "x = ((A * C) / B)". I'm fully aware that in this case it's absolutely redundant, but for more advanced expressions, it really helps keeping everything in place.
S sorex Expert Licensed User Longtime User Sep 11, 2015 #42 that's good, and using extra tabs or spaces to stand out sub formulas. better safe than sorry.
T Troberg Well-Known Member Licensed User Longtime User Sep 14, 2015 #43 HotShoe said: Many languages allow stacking statements on a single line. I personally never use it simply because it makes the code so much harder to read (for me at least) later on. I rarely even use single line IF statements hehe. Click to expand... Another comment on this: It's not a dangerous construct to allow, as, as you say, in most cases it won't be used. In the cases it is used, it's not because someone is lazy or don't understand what they are doing, it's because they have a specific reason for doing it (usually that it gives a neater code, such as in my earlier examples). In other words, it's a case of "breking the rules because I understand them", instead of "breaking the rules because I don't understand them".
HotShoe said: Many languages allow stacking statements on a single line. I personally never use it simply because it makes the code so much harder to read (for me at least) later on. I rarely even use single line IF statements hehe. Click to expand... Another comment on this: It's not a dangerous construct to allow, as, as you say, in most cases it won't be used. In the cases it is used, it's not because someone is lazy or don't understand what they are doing, it's because they have a specific reason for doing it (usually that it gives a neater code, such as in my earlier examples). In other words, it's a case of "breking the rules because I understand them", instead of "breaking the rules because I don't understand them".