Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Lexical analysis > Identifiers and keywords

Identifiers and keywords

Identifiers are sequences of alphanumeric characters, including the underscore (_). All ISO-Latin letters may be used in identifiers. However, an identifier cannot start with a number. Identifiers are case-sensitive and there is no limit to their length.

Some identifiers are called reserved words, which have special meanings. Keywords are:

      as         assert    boolean     break
      case      catch      class       classof
      const     copyof     cloneof     continue
      default   defined    delete      do
      else      extends    exit        false
      finally   float      foreach     for
      function  if         implements  import
      in        inf        interface   int
      is        has        module      namespace
      new       null       println     printbr
      print     return     sizeof      string
      static    super      switch      synchronized
      this      throw      true        try
      typeof    undefined  var         while
      yield

Although keywords cannot be used as ordinary identifiers, they can be escaped with the dollar sign ($). Unlike some other languages, the dollar sign does not denote a variable; it is merely a quoting character.

Constant keywords

Some of the keywords represent constant values rather than language constructs. These are:

   true   false   null   undefined   inf

Type keywords

Some of the keywords map into types found in anvil.lang These are:

   string   int   float

Examples:
  $if = 1;
  $for = 10;

Contributes notes:
Add a note
What's new | Anvil