aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorNic Gaffney <gaffney_nic@protonmail.com>2023-12-01 22:20:07 -0600
committerNic Gaffney <gaffney_nic@protonmail.com>2023-12-01 22:20:07 -0600
commitd767828cee67bae17b811062949653234aa14b28 (patch)
tree0a0306acc0fb9db19e6f7eff636d81c44209ee5d /examples
parent52f12c6c2c946d8d3c0a7845d48e11ff8b8fb597 (diff)
downloadsloth-d767828cee67bae17b811062949653234aa14b28.tar.gz
shitty ptrs
Diffstat (limited to 'examples')
-rw-r--r--examples/cgol.sloth2
-rw-r--r--examples/mem.sloth9
2 files changed, 10 insertions, 1 deletions
diff --git a/examples/cgol.sloth b/examples/cgol.sloth
index fafe440..db578f9 100644
--- a/examples/cgol.sloth
+++ b/examples/cgol.sloth
@@ -1,7 +1,7 @@
fn populate() [Int]
{
# Initialize life vector
- var life: [Int] = [1];
+ var life: [Int] = ["Hello World"];
vpopi(life);
# Fill the vector with random values
diff --git a/examples/mem.sloth b/examples/mem.sloth
new file mode 100644
index 0000000..cb52191
--- /dev/null
+++ b/examples/mem.sloth
@@ -0,0 +1,9 @@
+fn main() {
+ var intpointer: Int = memalloc(64);
+ println("We vibin");
+ assignrefi(intpointer, 10);
+ println("Still vibin");
+ var derefd: Int = drefi(intpointer);
+ print("Val of drefd: ");
+ println(istr(derefd));
+}