Created
January 5, 2023 12:06
-
-
Save mattdesl/8ea10d3a4abcb640c262ee03fbad5594 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; a function in scope | |
(fn square (x) (* x x)) | |
; anon/lambda function | |
((fn (x) (* x x)) 3) ; 9 | |
; variables | |
(var square2 4) | |
; let scoping | |
(let ( | |
(x 50) | |
(y (* 2 x)) | |
) (print x y)) ; prints 50 100 | |
; some builtins, logic, booleans | |
(and (= (math/floor 3.14) 3) (> 5 2)) ; true | |
; while loops | |
(var i 0) | |
(while (< i 10) (do | |
(print i) | |
(set i (+ 1 i)) | |
)) | |
; string concat and printing | |
(var str (.. "hello " "world")) | |
(print str) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment