Deprecated: Function get_magic_quotes_runtime() is deprecated in /home/public/forums/include/common.php on line 79

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/public/forums/include/common.php on line 83
GMLscripts.com :: style_guide
Invert GMLscripts.com

Script Submission Style Guide

The recommended style for scripts featured on GMLscripts.com is in the spirit of K&R. More specific guidelines can be found in Sun Java Code Conventions document. The point is to maintain site-wide consistency while encouraging good coding practices.

This site may change styles at some point, so always check this style guide before submitting new scripts.

/// script_name(a,b,c);
//
//  Returns or does something briefly described in the
//  first sentence. Full usage details should follow.
//
//  Use multiple paragraphs to add any special notes
//  as required for clarity.
//
//      a       brief argument description, data type
//      b       brief argument description, data type
//      c       brief argument description, data type
//
//  Less important notes can be placed down here.
//
/// GMLscripts.com/license
{
    var a,b,c,d,i;
    a = argument0;
    b = argument1;
    c = argument2;
    d = 0;

    //  Useful comments are encouraged.
    for (i=a; i<b; i+=c) {
        if (d mod 3) d += i;
        else d -= i;
    }

    //  Break up code sections to improve clarity.
    do {
        d += 10;
        d /= 2;
    } until (d > 0);

    //  Scripts should always return some value.
    return d;
}

GitHub: View · Commits · Blame · Raw