Reading Environment Variables
You can use IO.getEnv to retrieve the value of an environment variable. Since a variable might not be set, it returns an Option String.
def checkUser : IO Unit := do
let user? ← IO.getEnv "USER"
match user? with
| some name => IO.println s!"Hello, {name}!"
| none => IO.println "Could not find USER variable."