Author Topic: How do you indent when you code?  (Read 1700 times)

Simple question, I didn't think this would go in coding help because I didn't need help with a code :P



Do you code like this:

Code: [Select]
function killPlayer() {
      Self Delete();
}

Or like this:

Code: [Select]
function killPlayer()
{
      Self Delete();
}

I personally code the simple way (above one)

Code: [Select]
function killPlayer()
{
      Self Delete();
}
This way is the traditional, and easiest to read way.

I put everything on one line.

I code this way
Code: [Select]
function killPlayer()
{
      Self Delete();
}

Code: [Select]
function killPlayer()
{
      Self Delete();
}


Always the above way
Then i press ctrl-I in eclipse to make it clean and organized

Code: [Select]
function killPlayer()
     {
          Self Delete();
     }
I don't know if you can tab the {s after a function in Torque, but if you can then that is how I would do it.

I usually do the first one unless I don't think it really matters or I'm feeling lazy at the moment, then I do the second one. Sometimes as I scroll through a script I'm working on, I'll actually fix it though ;)

Code: [Select]
function killPlayer()
     {
          Self Delete();
     }
I don't know if you can tab the {s after a function in Torque, but if you can then that is how I would do it.
Torque ignores whitespace, so yes you can do this.


Code: [Select]
function stuff(%c)
{

%id = %c.bl_id;
echo(%id);

}

i tend to space things out a bit

Code: [Select]
function killPlayer() {
Self Delete();}

I'm terrible lol

Code: [Select]
function killPlayer() {
Self Delete();}

I'm terrible lol
i-i think i just puked a little. ;_;

i do the first

because i regularly code with lua, i like to think of the left curly brace as a "then" or "do", and the right brace as "end". with functions, i just like not having another entire line below the function name.

if (thing) {
  //stuff
}

while (thing) {
 //stuff
}


translates to


if thing then
  --stuff
end

while thing do
  --stuff
end


This way is the traditional, and easiest to read way.
it just annoys the mother loving forget out of me :U
« Last Edit: November 18, 2012, 01:02:48 PM by Kingdaro »

i-i think i just puked a little. ;_;

Yeah its really bad practice.

But I hate how wasteful it is adding indents and spaces. It just looks so big. Perhaps its a bit of a weird OCD thing, I can't stand doing anything other than making it as condensed as possible. RAWR.

Code: [Select]
function aFunction(%argument)
{
functionality();
}
That's how I generally try to format my code.