DEV Community

Ananth P
Ananth P

Posted on

A short note on lexical scope

(* standard ml *)
val x = 10
fun foo () = x
val result1 = foo ()      (* 10 *)
val x = 20
val result2 = foo ()      (* still 10 *)
Enter fullscreen mode Exit fullscreen mode

Run on sosml.org

Top comments (0)