Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > 2f23fa33dbe9052d0cf09567f1224d7c > files > 182

slang-doc-1.4.4-3mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE> A Guide to the S-Lang Language: Identifiers</TITLE>
 <LINK HREF="slang-6.html" REL=next>
 <LINK HREF="slang-4.html" REL=previous>
 <LINK HREF="slang.html#toc5" REL=contents>
</HEAD>
<BODY>
<A HREF="slang-6.html">Next</A>
<A HREF="slang-4.html">Previous</A>
<A HREF="slang.html#toc5">Contents</A>
<HR>
<H2><A NAME="s5">5. Identifiers</A></H2>

<P> 
<P>The names given to variables, functions, and data types are called
<EM>identifiers</EM>.  There are some restrictions upon the actual
characters that make up an identifier.  An identifier name must
start with a letter (<CODE>[A-Za-z]</CODE>), 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.
<P>Examples of valid identifiers include:
<BLOCKQUOTE><CODE>
<PRE>
      mary    _3    _this_is_ok
      a7e1    $44   _44$_Three
</PRE>
</CODE></BLOCKQUOTE>

However, the following are not legal:
<BLOCKQUOTE><CODE>
<PRE>
      7abc   2e0    #xx
</PRE>
</CODE></BLOCKQUOTE>

In fact, <CODE>2e0</CODE> actually specifies the real number
<CODE>2.0</CODE>.
<P>Although the maximum length of identifiers is unspecified by the
language, the length should be kept below <CODE>64</CODE> characters.
<P>The following identifiers are reserved by the language for use as
keywords:
<BLOCKQUOTE><CODE>
<PRE>
        !if            _for        do         mod       sign       xor
        ERROR_BLOCK    abs         do_while   mul2      sqr        public
        EXIT_BLOCK     and         else       not       static     private
        USER_BLOCK0    andelse     exch       or        struct
        USER_BLOCK1    break       for        orelse    switch
        USER_BLOCK2    case        foreach    pop       typedef
        USER_BLOCK3    chs         forever    return    using
        USER_BLOCK4    continue    if         shl       variable
        __tmp          define      loop       shr       while
</PRE>
</CODE></BLOCKQUOTE>
<P>
<HR>
<A HREF="slang-6.html">Next</A>
<A HREF="slang-4.html">Previous</A>
<A HREF="slang.html#toc5">Contents</A>
</BODY>
</HTML>