set name = "Test";
density = 1;
usr<<"I can use the semi-colon";
Just wanting to make sure this is acceptable before I begin my project. I'm still reading the DM manual and it hasn't stated anything.
Simple question. Will DM have problems using semi-colons at the end of code lines? I'll provide a quick sample below.
set name = "Test"; Just wanting to make sure this is acceptable before I begin my project. I'm still reading the DM manual and it hasn't stated anything. |
Feb 19 2013, 7:25 pm (Edited on Feb 19 2013, 7:33 pm)
Best response
|
|
Semi-colons, as well as curly braces, are optional. It's a style preference thing if you decide to use them or not.
|
No it shouldn't as you can do things such as
if(var/i){var/h=1;dothis();dothat();sleep(1);while(var/i=1){i--}} |
To sum things up, semi-colons (;) and curly braces ({}) are optional to make programmers of other languages more comfortable. There's nothing wrong with using them unless you abuse them by over-compressing your code, as ATHK describes.
Not using semi-colons and braces forces your code to automatically look slightly cleaner. I generally try to keep the black dot density low on my screen, too. |
How is that abusing them just curious? compressing code can be a good thing, although yes it looks very ugly.
|
Well, it makes no difference on the resulting DMB whether you use them or not.
Typically I'd say the pattern ATHK demonstrated is stylistic abuse. There's no benefit particularly to doing that in terms of readability (quite the opposite in fact), and it has no particular affect on anything semantically, so I'm not sure why you'd do it. |