diff options
| author | SAJJA EASWAR <eshwarsajja20@gmail.com> | 2026-01-25 22:59:36 +0530 |
|---|---|---|
| committer | SAJJA EASWAR <eshwarsajja20@gmail.com> | 2026-01-25 22:59:36 +0530 |
| commit | ebc8b94baa6bc694cb4829e2eb2934a1f17fa6a1 (patch) | |
| tree | 71b952ad455bf17d5bdea01472f0e2297f25eabe /examples/process/env.zc | |
| parent | 863118c95caac0d69a35f6ae4d2e83844734a8a1 (diff) | |
| parent | 489336b2101bf16edeec7bfc4379408eb19b936e (diff) | |
Merge branch 'main' into pr-109
Diffstat (limited to 'examples/process/env.zc')
| -rw-r--r-- | examples/process/env.zc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/process/env.zc b/examples/process/env.zc index 1506229..0ea7437 100644 --- a/examples/process/env.zc +++ b/examples/process/env.zc @@ -4,11 +4,11 @@ import "std/env.zc" fn main() -> int { // ---- - // get: Retrieves the env-var as borrowed string (char *) (no alloc) + // get: Retrieves the env-let as borrowed string (char *) (no alloc) // --- // @Example usage: On Linux (and some variants) PATH is already defined. // --- - var path = Env::get("PATH"); + let path = Env::get("PATH"); if (path.is_some()) { println "PATH is: {path.unwrap()}"; @@ -17,18 +17,18 @@ fn main() -> int { } // ---- - // set: Sets an env-var variable - // get_dup: Retrieves the env-var as caller-owned String() (heap alloc) + // set: Sets an env-let variable + // get_dup: Retrieves the env-let as caller-owned String() (heap alloc) // --- // @Example usage: In your terminal type "export HELLO=world" or use Env::set() // --- - var res = Env::set("HELLO", "world"); + let res = Env::set("HELLO", "world"); //=> check res against EnvRes::OK() - var hello = Env::get_dup("HELLO"); + let hello = Env::get_dup("HELLO"); if (hello.is_some()) { - var hello_str = hello.unwrap(); + let hello_str = hello.unwrap(); defer hello_str.free(); println "HELLO is: {hello_str.c_str()}"; @@ -37,11 +37,11 @@ fn main() -> int { } // ---- - // unset: Unsets an existing env-var + // unset: Unsets an existing env-let // --- Env::unset("HELLO"); - var hello_now2 = Env::get("HELLO"); + let hello_now2 = Env::get("HELLO"); if (hello_now2.is_none()) { println "HELLO is now unset"; |
