From daecd330d5719e4a65d5b07f81209f99f423e6a2 Mon Sep 17 00:00:00 2001 From: Cody Date: Mon, 26 Jun 2023 18:49:29 -0500 Subject: vset, vget & vlen --- examples/hello.sloth | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'examples/hello.sloth') diff --git a/examples/hello.sloth b/examples/hello.sloth index f4e6692..db71b01 100644 --- a/examples/hello.sloth +++ b/examples/hello.sloth @@ -20,3 +20,21 @@ fn testtwo(list: [Int]) Int { return x; } +fn testthree(list: [Int]) Int { + var x: Int = vlen(list); + return x; +} + +foreign fn testback(x: Int) Void; + +fn testfour(list: [Int]) Int { + vseti(list, 0, 888); + var i: Int = 0; + while i < vlen(list) { + var value: Int = vgeti(list, i); + testback(value); + i = i + 1; + } + return 0; +} + -- cgit v1.2.3