diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-25 15:12:12 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-25 15:12:12 +0000 |
| commit | 7d1944ab9d2307f2736afe8520436872db1c7617 (patch) | |
| tree | 7380a4f148f9ce0b70ed9f02cfa5e8561c783a7a /examples/process | |
| parent | 8b720543f538862796fec0ff6b7ea12cb140bf0f (diff) | |
'let' it be
Diffstat (limited to 'examples/process')
| -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"; |
