This built-in predicate adds a new environment variable to the current process or sets a new value for an existing environment variable. Only the environment of the current process can be changed. If the environment variable was successfully added or changed then the predicate is exited, else it fails.
| Examples | |
| set_env('test', 'house'). | If the environment of the current process has no variable called 'test' then a new variable is added with the value 'house'. |
| set_env('test', 'house'), set_env('test', 'office'). |
The value of the varriable 'test' is changed from 'house' to 'office'. |
| Exceptions | |
| The first or second argument is a variable | an instantiation_error exception is thrown |
| The first or second argument Arg is not an atom | a type_error(atom, Arg) exception is thrown |