std.env.opt
Show source codeHide source code
fn pub opt(name: String) -> Option[String] {
match inko_env_get(_INKO.state, name) {
case { @tag = 0, @value = val } -> Option.Some(val as String)
case _ -> Option.None
}
}
fn pub static opt(name: String) -> Option[String]
Returns an optional value of an environment variable.
Examples
Obtaining the value of an environment variable:
import std.env
env.opt('HOME') # => Option.Some('/home/alice')