mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
print ints as ints instead of floats
i.e. no trailing dot
This commit is contained in:
parent
446fde29d1
commit
222de81a19
1 changed files with 1 additions and 1 deletions
|
|
@ -4,7 +4,7 @@ type lox_value = String of string | Number of float | Bool of bool | Nil
|
||||||
let string_of_lox_value lox_value =
|
let string_of_lox_value lox_value =
|
||||||
match lox_value with
|
match lox_value with
|
||||||
| String s -> s
|
| String s -> s
|
||||||
| Number x -> string_of_float x
|
| Number x -> if Float.is_integer x then string_of_int (Int.of_float x) else string_of_float x
|
||||||
| Bool b -> string_of_bool b
|
| Bool b -> string_of_bool b
|
||||||
| Nil -> "nil"
|
| Nil -> "nil"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue