Don't click here unless you want to be banned.

LSL Wiki : whitespace

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org

Whitespace


Whitespace is simply the empty space in between anything in a programming language, such as LSL. Whitespace is completely ignored by the LSL compiler, so different formatting styles can arise. Unfortunately, this also allows scripters to write code that neglects whitespace formatting standards, often confusing readers.

All of the following examples have the same effect and efficiency, even though their whitespace is different. Note how much easier it is to read the first example.

Example 1:
default
{
    state_entry()
    {
        llSay(0, "Hello, Avatar!");
    }

    touch_start(integer total_number)
    {
        llSay(0, "Touched.");
    }
}

Example 2:
default 
{
    state_entry() { llSay(0, "Hello, Avatar!"); }

    touch_start(integer total_number) { llSay(0, "Touched."); } 
}

Example 3:
default{state_entry(){llSay(0, "Hello, Avatar!");
}touch_start(integer total_number){llSay(0, "Touched.");}}

PLEASE, FOR THE LOVE OF ALL THAT IS HOLY, DO NOT WRITE CODE LIKE THIS.

Example 4:
default 
{
state_entry   () 
                                        {   llSay(0,"Hello, Avatar!"          )
;    }
touch_start   ( integer     total_number )                             {
llSay (   0, "Touched.")
;}}

Styleguide
There is no comment on this page. [Display comments/form]