Jump to content

Tidy Your Script File


Recommended Posts

David mocks me when I say that I have to do this to read his and C code. :whistle:

I'm completely code blind unless something is perfectly indented at tab size 2/4.  If I can't see the obvious block structure from the other side of the room then it's just gibberish.

I use a consistant style. It just is not the same style Jon happens to use. B)

Mine:

if (a<0) {
   cmd1();
   cmd2();
} else if (a>0) {
   cmd3();
   cmd4();
} else {
   cmd1();
   cmd4();
}
switch (c) {
case 1:
   cmd5();
case 2:
   cmd6();
   break;
default:
   cmd7();
}

Jon's:

if (a<0) 
{
   cmd1();
   cmd2();
} 
else 
{
   if (a>0) 
  {
      cmd3();
      cmd4();
   } 
   else 
   {
      cmd1();
      cmd4();
   }
}
switch(c) 
{
   case 1:
      cmd5();
      cmd6();
      break;
   case 2:
      cmd6();
      break;
   default:
      cmd7();
}

Just a few differences. :angry:

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to post
Share on other sites
  • Administrators

I use a consistant style.  It just is not the same style Jon happens to use. B)

I think yours is the more "proper c programmer" style from what I've seen. I hardly ever see code indented my newbie way :whistle:
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...