diff options
Diffstat (limited to 'val.c')
-rw-r--r-- | val.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -0,0 +1,16 @@ +#include <stdio.h> +#include "val.h" + +void print_val(Val v) { + switch (v.ty) { + case TY_NIL: + printf("nil\n"); + break; + case TY_NUM: + printf("%f\n",AS_NUM(v)); + break; + case TY_BOOL: + printf("%s\n",AS_BOOL(v) ? "true" : "false"); + break; + } +} |