|
|
|
|
|
by zem
3267 days ago
|
|
for the case of x = 1
print_int(x)
x="a"
print_string(x)
the type system could simply instantiate a new variable, x: string, that shadowed the old x: int. this is perfectly valid ocaml, for instance: let x = 1 in
Printf.printf "%d\n" (x + 1);
let x = "hello" in
print_endline (x ^ " world")
|
|