From 6da4f73ffb664edfb7063a10206306b0aafd773f Mon Sep 17 00:00:00 2001 From: SpookyDervish <78246495+SpookyDervish@users.noreply.github.com> Date: Sun, 12 Oct 2025 21:15:17 +1100 Subject: [PATCH] started writing examples for the syntax --- tests/conditionals.pla | 9 +++++++++ tests/functions.pla | 8 ++++++++ tests/helloWorld.pla | 2 ++ tests/variables.pla | 13 +++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 tests/conditionals.pla create mode 100644 tests/functions.pla create mode 100644 tests/helloWorld.pla create mode 100644 tests/variables.pla diff --git a/tests/conditionals.pla b/tests/conditionals.pla new file mode 100644 index 0000000..b02c639 --- /dev/null +++ b/tests/conditionals.pla @@ -0,0 +1,9 @@ +depend "io.pla" + +if (1 + 2 == 3) { + print("The universe is functional!") +} +unless +{ + print("WHAT, HOW") +} \ No newline at end of file diff --git a/tests/functions.pla b/tests/functions.pla new file mode 100644 index 0000000..d560fd5 --- /dev/null +++ b/tests/functions.pla @@ -0,0 +1,8 @@ +depend "io.pla" +depend "string.pla" + +add = Func(a: Int, b: Int): Int { + return a + b +} + +print(String(add(1, 3))) \ No newline at end of file diff --git a/tests/helloWorld.pla b/tests/helloWorld.pla new file mode 100644 index 0000000..2dbfefe --- /dev/null +++ b/tests/helloWorld.pla @@ -0,0 +1,2 @@ +depend "io.pla" +write("Hello, World!") \ No newline at end of file diff --git a/tests/variables.pla b/tests/variables.pla new file mode 100644 index 0000000..65c9739 --- /dev/null +++ b/tests/variables.pla @@ -0,0 +1,13 @@ +depend "string.pla" + +myInt: Int = 123 +myDecimal: Float = 0.456 +myBoolean: Bool = true +myString: String = "Hello!\n" +myList: List = [1, "hi", true, [1, 2, 3], 0.789] + +write(String(myInt)) +write(String(myDecimal)) +write(String(myBoolean)) +write(myString) +write(String(myList)) \ No newline at end of file