Opa is a functional language, so there are no global variables in the language. However, similar behavior can be achieved with Mutable. At the top level, a value is declared using:
global_var = Mutable.make(initial_value)
where initial_valueis the initial value for the variable (of some type t). Then you can get the value with:
global_var.get()
and install it with:
global_var.set(new_value)
See the Opa API Overview for more information .
, , ; Opa (. Opa ).