summaryrefslogtreecommitdiff
path: root/val.c
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-06-20 23:26:18 +0100
committerubq323 <ubq323@ubq323.website>2024-06-20 23:26:18 +0100
commitf331192861d8ba02af7fd47f2e0c6d6db7515007 (patch)
tree9752cdea672d64f3ebfd3ee142185468510708fd /val.c
parentfa8891ffe017ae890f0ef07915cf8b52acd7304a (diff)
add (if cond if-true if-false) builtin
Diffstat (limited to 'val.c')
-rw-r--r--val.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/val.c b/val.c
index 6f1dd9e..19f96a0 100644
--- a/val.c
+++ b/val.c
@@ -75,6 +75,12 @@ void println_val(Val v) {
putchar('\n');
}
+bool is_truthy(Val v) {
+ if (IS_NIL(v) || ( IS_BOOL(v) && AS_BOOL(v) == false))
+ return false;
+ return true;
+}
+
const char *typename_str(Val v) {
switch(v.ty) {