Guest User

Not C-Flat anymore

a guest
May 25th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1.  
  2. // single line comment
  3. /* multi
  4.  
  5. line
  6.  
  7. comment*/
  8.  
  9. /*
  10. constants are typed values that can't be changed and
  11. must be initialized. Their address can't be taken.
  12. */
  13. const ANSWER : int = 42;
  14.  
  15. /*
  16. variables are a typed mutable value.
  17. It's declaration consists of a type and a name
  18. and may also define an initial value.
  19. */
  20. var variable : int;
  21. var variable : int = 10;
  22. var variable : int = 0x10;
  23.  
  24. /*
  25. variables may also have a storage class
  26. specifier that defines where the variable is
  27. stored and how it's memory is shared.
  28. */
  29. private var variable : int; // one per instance
  30. static var variable : int ; // one per thread
  31. private static var variable : int; // one per instance and thread
  32. global var variable : int ; // one per process (default)
  33. shared var variable : int ; // one per executing system
  34.  
  35. /*
  36. methods are declared by a type and a name
  37. followed by an argument list enclosed in
  38. round brackets.
  39.  
  40. parameters are separated by commands are are
  41. declared ba a type followed by the parameter
  42. name.
  43.  
  44. each method header declaration must follow a method
  45. body enclosed in curly brackets.
  46.  
  47. each method can be exported by placing an 'export'
  48. keyword in front of the method header.
  49. */
  50. func main() -> int
  51. {
  52. return 1;
  53. }
  54.  
  55. func square(i : int) -> int
  56. {
  57. return i * i;
  58. }
  59.  
  60. export func sum(a : int, b : int) -> int
  61. {
  62. return a + b;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment