summaryrefslogtreecommitdiff
path: root/val.c
diff options
context:
space:
mode:
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) {