Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
(def foo
(or (System/getenv "FOO") "none"))
string foo = Environment.GetEnvironmentVariable("FOO");
if (string.IsNullOrEmpty(foo)) foo = "none";
foo = System.get_env("FOO", "none")
Foo = os:getenv("FOO","none").
call get_environment_variable ("FOO", length=n, status=st)
if (st /= 0) then
foo = "none"
else
allocate (character(len=n) :: foo)
call get_environment_variable ("FOO", value=foo)
end if
def foo = System.getenv('FOO') ?: 'none'
const foo = process.env.FOO ?? 'none'
const foo = process.env["FOO"] || "none";
String foo = System.getenv("foo");
if (foo == null) {
foo = "none";
}
val foo = System.getenv("FOO") ?: "none"
foo = os.getenv("FOO") or "none"
$foo = getenv("FOO") ?: "none";
foo = ENV["FOO"]
val foo = sys.env.getOrElse("FOO", "none")
| foo |
foo := CEnvironment getUserEnvironment at: 'FOO' ifAbsent: [ 'none' ].
foo = IIf(Environ("FOO") = "", "none", Environ("FOO"))