Hm, Joozey and Michael, if you love spaces then you should be consequent and use them after every bracket and after tags like "if":
displayNumber( arg, 14, 23 );
if( arg < 10 ) { ...
should consequently be:
displayNumber ( arg, 14, 23 );
if ( arg < 10 ) { ...
I personally think that it does not help and the eye has to move too much to get the info.
That would be overkill. I just want variables separated from operators, and arguments separated so you can "count" them quickly.
What notation you guys prefer when you're defining variables/functions...
1) foo_bar
2) FooBar
3) fooBar
I prefer the first one for variables, but always use the second one (Pascal notation) for functions.
Also does anyone prefer the ternary operator to if/else? I hardly use it.
Depends, as we have no "IntelliSense" in SED like in Visual Studio, I use different naming conventions for c-script than I use in C# using visual studio.
example from c-script:
function vDialogReadFrom(sFilename)
{
if(ibDialogInProgress == true){ return; } else { ibDialogInProgress = true; }
sysDialogHandle = file_open_read(sFilename);
while(file_str_readto(sysDialogHandle, sDialogCurIn, sDialogDelimiter, 1000) != -1)
{
the prefixes:
v - void
s - string
sys - something engine internal, like file handles
ib - internal boolean
etc...
helps while reading the code, you know exactly what variable stores what kind of information.