ASM   21

example

Guest on 26th July 2022 12:59:50 AM

  1. #!ace
  2.  
  3. # This is an example program demonstrating a few features.
  4.  
  5. # Here are some variables
  6.  
  7. i : int = 7
  8. j : int = -1
  9. f : float = 3.14159
  10. s : string = "Hello"
  11. ai : [int]
  12. af : [float]
  13. dict : [int -> float]
  14. tuple : (string, int, int, float)
  15. list : {int} = {5 -> 7 -> 8}
  16. fn : function(int, int): int = add_something
  17.  
  18. # And here are some functions
  19.  
  20. main : function(args: [string])
  21.         if size(args) == 1
  22.                 print "No args"
  23.         else
  24.                 print_my_stuff()
  25.         for arg in args
  26.                 print arg
  27.  
  28. add_something : function(x: int, y: int): int
  29.         return x + y
  30.  
  31. print_stuff : function()
  32.         print i
  33.         print j
  34.         print f
  35.         print s
  36.  
  37. print_my_stuff := print_stuff

Raw Paste


Login or Register to edit or fork this paste. It's free.