A Guide to the S-Lang Language: Identifiers

Next Previous Contents

## 5. Identifiers

The names given to variables, functions, and data types are called identifiers. There are some restrictions upon the actual characters that make up an identifier. An identifier name must start with an alphabetic character (`[A-Za-z]`), an underscore character, or a dollar sign. The rest of the characters in the name can be any combination of letters, digits, dollar signs, or underscore characters. However, all identifiers whose name begins with two underscore characters are reserved for internal use by the interpreter and declarations of objects with such names should be avoided.

Examples of valid identifiers include:

> `

>           mary    _3    _this_is_ok
>           a7e1    $44   _44$_Three

> `

However, the following are not legal:

> `

>           7abc   2e0    #xx

> `

In fact, `2e0` actually specifies the double precision number `2.0`.

There is no limit to the maximum length of an identifier. For practical usage it is wise to limit the length of identifiers to a reasonable value.

The following identifiers are reserved by the language for use as keywords:

> `

>        abs            and           andelse       break         case
>        catch          chs           continue      define        do
>        do_while       else          ERROR_BLOCK   exch          EXIT_BLOCK
>        finally        _for          for           foreach       forever
>        !if            if            loop          mod           mul2
>        not            or            orelse        pop           private
>        public         return        shl           shr           sign
>        sqr            static        struct        switch        __tmp
>        throw          try           typedef       USER_BLOCK1   USER_BLOCK2
>        USER_BLOCK0    USER_BLOCK4   USER_BLOCK3   using         variable
>        while          xor

> `

Next Previous Contents