Skip to main content

Code Format

Everybody has their own preference for code formatting. For this project a rule of thumb should be that it must be as readable as possible. A good way of ensuring this is to use tabs to format your code using one tab for each nested layer of code.

An example of a simple nested IF condition is shown below.
//A simple IF to set testValue to a new value according to its current value or that of testValue2

if(testValue > 0){

testValue = testValue - 100;

else if(testValue < 0){

              testValue = testValue + 100;

}else{

              If(testValue2 > 0){

                            testValue = testValue2 – 100;

              }else if(testValue2 < 0){

                            testValue = testValue2 + 100;

}else{

                            testValue = 9999;

}

}

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!