• Description:
    Variables can be defined via DEF keyword, nearly every where you like, outside a procedure they are global, inside a procedure they are local.

  • Syntax:
      DEF<ext> <name> [ <field> ] [ =<default> ] [ :<type> ]...
    

    See this for <ext> explanation.
      DEF name                  // name is VOID/LONG
      DEF name:type             // name is type
      DEF name[]:type           // name is PTR TO type
      DEF name[][]:type         // name is PTR TO PTR TO type
      DEF name[a]:type          // name is array of a types
      DEF name[a,b]:type        // name is array of a*b types with width of a
      DEF name[:a]:type         // name is PTR TO type of width a
      DEF name[:a][:b]:type     // name is PTR TO type of width a and height b
      etc.
    

    (See Types to get info about ":" character between brackets)
      EDEF name[:type]          // for external variables (see Multiple source)
    
  • Simplier/Faster variable definition:
      DEFL  name        is the same as  DEF name:LONG
      DEFUL name        is the same as  DEF name:ULONG
      DEFW  name        is the same as  DEF name:WORD
      DEFUW name        is the same as  DEF name:UWORD
      DEFB  name        is the same as  DEF name:BYTE
      DEFUB name        is the same as  DEF name:UBYTE
      DEFF  name        is the same as  DEF name:FLOAT
      DEFD  name        is the same as  DEF name:DOUBLE
      DEFS  name[x]     is the same as  DEF name[x]:STRING
    
  • Default values:
    Default values are used in two ways: First is global, where You are slightly limited. Global variables can contain only numbers, constants, strings and lists. Nothing more. Local variables can contain everything. Each variable can have its initial value/list/string:
      DEF num=123:LONG,
          float=456.789:FLOAT,
          name='Hello World!\n':PTR TO CHAR,
          list=[12,23,34,45,56]:UWORD
    

    or more complex:
      DEF num=12*3+232/6:LONG,
          float=31/2.2+76.3:FLOAT,
          name='Hello '+
               'Amigans!\n',
          list=[[1,2,3]:LONG,[4,5,6]:LONG,[7,8,9]:LONG]:PTR TO LONG
    

    Variables do not must be defined before they are used, if they are global it is definitely unimportant, if they are local there are some limitations:
      PROC main()
         PrintF('n=\d, m=\d\n',n,m)
         DEF n=1
      ENDPROC
      DEF m=2
    

    is same as:
      PROC main()
         DEF n
         PrintF('n=\d, m=\d\n',n,m)
         n:=1
      ENDPROC
      DEF m=2
    

    it means, that if you want to give to variable default value (n=1), the value will be given on the place where it is defined (in our case after it was printed)