• Description: Every programmer wanted once to use one piece of source more times, most programming languages allows You to use macros to do this stuff, but each macro simply copies contents of the macro into the source and it very expands the source size, this feature makes sth similar, not so smart like macros, but each occurence in the source takes only 2, 4 or 6 bytes (depending on the size of the procedure, thanks to phxass, else it would be always 4 or 6 bytes :)

  • Syntax:
    • Definition:
        SUB <name>
          <code>
        ENDSUB
      

      Where <code> is the code You want to use as the macro and <name> is the launching name.
    • Usage:
        <name>
      

      On every occurence of this word in the source will be one jump to the code defined like above.


  • Notes:
    • Each SUB definition must be placed inside the procedure, it's definition doesn't affect the source where it is defined.
    • Pay attention that You don't leave the SUB before ENDSUB reached, because it may cause some stack problems!!!


  • Example:
    PROC main()
       DEF	result
       result:=10
       print
       result*=15
       print
       result/=9
       print
    
       SUB print
          PrintF('result is \d.\n',result)
       ENDSUB
    ENDPROC
    

    This code will print this:
    result is 10.
    result is 150.
    result is 16.