Add examples

This commit is contained in:
Joscha 2024-08-02 12:45:33 +02:00
parent 802d776f29
commit 4db27de0c9
6 changed files with 40 additions and 0 deletions

5
examples/call.tada Normal file
View file

@ -0,0 +1,5 @@
module
foo(),
foo(3),
foo{ 1, foo: true },

4
examples/expr.tada Normal file
View file

@ -0,0 +1,4 @@
module
a + 2 * 3 - 4,
{ 1, nil, true, c: "foo" },

7
examples/field.tada Normal file
View file

@ -0,0 +1,7 @@
module
foo.bar,
foo.bar = 7,
foo[1 + 1],
foo[1 + 1] = 2,

11
examples/func_def.tada Normal file
View file

@ -0,0 +1,11 @@
module
function() true,
function(arg) arg + 1,
function{ arg } arg + 1,
function foo() true,
function foo(arg) arg + 1,
function foo{ arg } arg + 1,
function() foo(),
(function () foo)(),

View file

@ -0,0 +1,4 @@
module
{ a, b, c: d } = { 1, 2, c: 3 },
local { a, b, c: d } = { 1, 2, c: 3 },

9
examples/var.tada Normal file
View file

@ -0,0 +1,9 @@
module
["x"],
["x"] = nil,
local ["x"] = nil,
x,
x = nil,
local x = nil,