Special Characters and Reserved Words

Characters and words the RapidScript compiler uses during compilation. Users may not use them as variable names.

Special Characters

Special characters cannot be part of any user-defined variable or function names, as they each hold a special role.

  • ( and ):

    • Each ( must have a matching ) somewhere after it, unless the ( was placed within a string.

    • As the function call operator: The function name must be immediately followed by the ( character. If the function takes any parameters, they should be passed to the function by placing them as a comma-separated list between the ( and ) characters.

    • As the markers for special statements (conditional statements and loops): When immediately preceded by a keyword such as if, for, while, or do, these characters denote the start and end of these special statements.

    • As mathematical grouping brackets: The ( and ) characters must enclose a valid mathematical expression. The enclosed mathematical expression will be evaluated before other operations.

  • { and }: The scoping brackets. These characters define a new scope between them.

    • Each { must have a matching } somewhere after it unless the { was placed within a string.

    • Every function body must be enclosed within a { } pair.

  • ;: The statement terminator. Most statements in RapidScript (except for function signatures, conditional statements, and loops) require this character to indicate where the statement ends. The compilation will fail if a statement is missing this character.

  • ,: The list delimiter. This character separates entries in a parameter list.

  • ": The double-quote characters indicate the start and end of a string literal.

  • Every operator is also considered a special character in RapidScript. For example, the variable name hyphen-ated; is invalid.

Reserved Words

Reserved words are words that cannot be used for any user-defined variable or function names. They may be a substring of the name, but cannot be the standalone name. For example, the variable name return is invalid, but the name returnValue is fine.

  • return: Designate the value a function returns. This statement is the last statement executed in a function.

  • if: Indicate the start of a conditional statement.

  • else: Indicate the start of the "else" case of a conditional statement.

  • global: Indicate that a variable exists in global memory, and is visible in multiple RapidScript programs and is accessible for reading and writing through the RapidSequencer API. This can only be applied to variables in the global scope.

    • Example usage: global int32 variable = 1;

  • for: Indicate the beginning of a for loop.

  • while: Indicate the beginning of a while loop.

  • do: Indicate the beginning of a do while loop.

  • break: Skip the remainder of the current iteration of a loop and terminate the enclosing loop.

  • continue: Skip the remainder of the current iteration of a loop (but continue looping).

  • All of the data types are also reserved words.

Last updated