Skip to content
Raph Hennessy edited this page Dec 5, 2015 · 5 revisions

In Q OS Code, we try to keep similar standard practices across all files. To help do this, we have made this page to clarify how things should be formatted. Please get permission from @raphydaphy if you want to modify this page because it provides an important definition of how code should be formatted.

If/Else Statements

Normal If/Else statements should be formatted like shown below.

if (thing is true)
{
    // do stuff here
}
else if (other thing is true)
{
    // do other stuff here
}
else
{
    // do random more stuff
}

There are two important things to note in the formatting of these statements. The first important thing to note is that each { and } symbol are written on a separate line, and the words if else if and else are always on their own line with there (arguments).

The other important thing to note in the formatting is that { and } symbols are always used even when there is only one line of code inside that if/else/else if statement.

The reason that we write code like this for if/else/else if statements is to maintain a similar formatting style across all our if/else/else if statements and to allow easy readability of your code.

It is also important to note that these formatting principals for if statement's apply to all statement's such as this. This includes for, while, if, elseandelse if`.

Clone this wiki locally