| Blockland Forums > Modification Help |
| Hydrobot v. 1.1 |
| << < (6/7) > >> |
| Chrono:
--- Quote from: MegaScientifical on November 02, 2010, 12:11:13 AM ---I'm confused what you mean by this. Tabs? --- End quote --- The fact you put {s on the end of a line of code. |
| Uristqwerty:
It would only work with VERY consistant spacing, and still is easily confusing. For people who are still learning, it is best to put the {}s on their own line, like this: --- Code: ---function example() { for(%i=0; %i<10; %i++) { if(%i > 5) { echo(%i + 1) } else echo(%i SPC "+ 1"); } } --- End code --- It isn't even a good idea to leave single statements without {}s, even though you can (see: The else in the example), until you really understand syntax and can use consistant indenting. |
| MegaScientifical:
--- Quote from: Chrono on November 02, 2010, 08:49:29 PM ---The fact you put {s on the end of a line of code. --- End quote --- Well it's how I learned, and it was from pretty prominent coders. For me, having too many blank areas scares me, but meh. Chrono, if you saw my code files... you'd be crying at how horrific they are. |
| Uristqwerty:
At one time, my code was extremely ugly, too. Then I left Blockland for a while and just used C. When a small mistake could mean an unexpected segfault, you quickly learn to make errors obvious. And check all pointers against null. And confirm function parameters, even if "that will never happen", because it is far better that when "never" DOES happen, your code catches it and can respond (probably by giving a clear error log and quitting). Most importantly: Clarity is critical. If you can easily understand code where the {}s are on the same line as other code, go for it. However, then you rely exclusively on your indentation to quickly identify what code happens when. Also: Tabs are evil: Everyone sets them differently when they can set them. Use tabs for alignment, use spaces for indentation. That way, if someone uses a different tab width, only the alignment of things like the =s in a large block of assignments or data will be different. |
| Blocker Ctgr:
At first I thought the problem was the cs. but I figured out this is TS not C++ |
| Navigation |
| Message Index |
| Next page |
| Previous page |