aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorc+12023-10-25 13:12:31 -0400
committerc+12023-10-25 13:12:31 -0400
commit820e75e4caa70be9719c728187a56f225e0bc136 (patch)
tree5910b5921cbf6321aa9e436d065b306bbbbb7f7a /examples
parent5a502944d161f6e3d972e94e244993c730e8a91a (diff)
halk.
Diffstat (limited to 'examples')
-rw-r--r--examples/hello.halk28
1 files changed, 5 insertions, 23 deletions
diff --git a/examples/hello.halk b/examples/hello.halk
index 6e5f7bf..d046d19 100644
--- a/examples/hello.halk
+++ b/examples/hello.halk
@@ -9,28 +9,10 @@
argument 'target', also of type 'str' `
` some more functions `
-:void:add1. :int:n = n = +. n, 1;
-:int:fac.:int:n=if.(==.n,0),1,*.n,fac.-.n,1;
+:void:add1.:int:n+=. n, 1;
+:int:fac.:int:n=?.(=.n,0),1,*.n,fac.-.n,1;
-:int:fib. :int:n = if. (<=. n, 1), ` multiple lines can be used for clarity `
- n,
- +. fib.(-. n, 1), fib. -. n, 2);
+:int:fib. :int:n = ?. (<=. n, 1), ` multiple lines can be used for clarity `
+ n,
+ +. fib.(-. n, 1), fib. -. n, 2);
-
-:void:print_greet.:str:target = stdio/pln.greet.target; ` namespaces `
-
-:namespace:people = { ` create namespace `
- struct.person, :int:age, :str:name; ` create a struct -- syntax not finalized `
-
- :str:person_report. :struct:person = {
- :str:age = int->str.person.age;
- :str:name = person.name;
-
- strcat. "NAME:\t", name, "\nAGE:\t", age;
- }
-
- :void:person_birthday. :struct:person = {
- stdio/pln. "Happy birthday, ", person.name;
- person.age = +.person.age, 1;
- }
-}