Code Indentation

Status
Not open for further replies.

brsy

nah mang
May 12, 2011
1,530
272
Programming styles commonly deal with the visual appearance of source code, with the goal of requiring less human cognitive effort to extract information about the program. Software has long been available that formats source code automatically, leaving coders to concentrate on naming, logic, and higher techniques. As a practical point, using a computer to format source code saves time, and it is possible to then enforce company-wide standards without debates. Indent styles assist in identifying control flow and blocks of code. In some programming languages indentation is used to delimit logical blocks of code; correct indentation in these cases is more than a matter of style. In other languages indentation and white space do not affect function, although logical and consistent indentation makes code more readable. Compare:
PHP:
if (hours < 24 && minutes < 60 && seconds < 60) {
    return true;
} else {
    return false;
}
or
PHP:
if (hours < 24 && minutes < 60 && seconds < 60)
{
    return true;
}
else
{
    return false;
}
* Credits to Wikipedia for this tutorial:
 

DaLightz

See ya'll in the afterlife.
May 19, 2012
1,136
262
Notepad++ only follows an existing indented code/PHP file. It's up to you on how to indent it, once you put an indent, when you click 'Enter' - it follows the indent.
I'm also trying out Aptana Studio 3. Seems like it auto indents with the second var with it. So like, if I was typing $lol = ' it would make that extra ';
 
Status
Not open for further replies.

Users who are viewing this thread

Top