Example: Environment variables

Description

Using features from the class EXECUTION_ENVIRONMENT to create and retrieve an environment variable.

Notes

The make procedure of the class APPLICATION below uses the features put and get, inherited from the class EXECUTION_ENVIRONMENT, to create the environment variable MY_VARIABLE with value "Hello World!", and then to retrieve the value by key and print it.

Solution

class APPLICATION inherit EXECUTION_ENVIRONMENT create make feature {NONE} -- Initialization make -- Create and retrieve an environment variable. do put ("Hello World!", "MY_VARIABLE") print (get ("MY_VARIABLE")) end end

Output

Hello World!

cached: 03/19/2024 2:14:11.000 AM