GMLscripts.com

Script Submission Style Guide

The recommended style for script functions featured on GMLscripts.com is in the spirit of K&R and One True Brace.

Always check this style guide for changes before submitting contributions.

/// @func   my_function(alfa, bravo, charlie)
///
/// @desc   Returns or does something briefly described in the
///         first sentence. Full usage details should follow.
///
///         Note: Use multiple paragraphs for clarity or to add
///         any special usage notes.
///
/// @param  {datatype}  alfa        brief parameter description
/// @param  {datatype}  bravo       brief parameter description
/// @param  {datatype}  charlie     brief parameter description
///
/// @return {datatype}  description of returned value
///
/// GMLscripts.com/license

function my_function(alfa, bravo, charlie)
{
    var delta = 0;

    // Useful comments are encouraged.
    for (i=alfa; i<bravo; i+=charlie) {
        if (delta mod 3) {
            delta += i;
        } else {
            delta -= i;
        }
    }

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

    // Functions should always return some value.
    return delta;
}