diff options
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -256,19 +256,22 @@ sym_t* try_eval_internal(sym_t* symbol, hashtable_t* symbolScope) { } } else if (hash == get_hash("print")) { - sym_t* v = eval(symbol->args[0], symbolScope); - if (v->litType == INT) { - printf("%d\n", symtoi(v)); - } - else if (v->litType == FLOAT) { - printf("%.5f\n", symtof(v)); - } - else if (v->litType == STRING) { - char* s = symtos(v); - printf("%s\n", s); - free(s); + for (int i = 0; i < symbol->argCount; i++) { + sym_t* v = eval(symbol->args[i], symbolScope); + if (v->litType == INT) { + printf("%d", symtoi(v)); + } + else if (v->litType == FLOAT) { + printf("%.5f", symtof(v)); + } + else if (v->litType == STRING) { + char* s = symtos(v); + printf("%s", s); + free(s); + } + destroy_sym(v); } - destroy_sym(v); + printf("\n"); return init_sym_int(1); } else { |
