diff options
author | ubq323 <ubq323@ubq323.website> | 2024-06-20 23:26:18 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-06-20 23:26:18 +0100 |
commit | f331192861d8ba02af7fd47f2e0c6d6db7515007 (patch) | |
tree | 9752cdea672d64f3ebfd3ee142185468510708fd /val.c | |
parent | fa8891ffe017ae890f0ef07915cf8b52acd7304a (diff) |
add (if cond if-true if-false) builtin
Diffstat (limited to 'val.c')
-rw-r--r-- | val.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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) { |