Skip to content

Commit 0582458

Browse files
committed
Lispy script example
1 parent be1c5ec commit 0582458

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

example.lspy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
; This is a comment
2+
3+
; This file and other Lispy scripts can be loaded into the interpreter.
4+
; for example:
5+
; go run prompt.go example.lspy
6+
7+
(load "hello.lspy") ; Load another example script to print a greeting
8+
9+
(print "Error example:")
10+
(if (== (+ 2 2) 5)
11+
{print "five year plan in four years"}
12+
{error "Arithmetic Nonsense"} ; Errors can also be displayed
13+
)

hello.lspy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(print "Hello, world!")

0 commit comments

Comments
 (0)