In Ruby, the ENV[name] method is used to return the value for the environment variable name. If it does not exist, it returns nothing. If the name is invalid, it throws an error.
ENV[name]
name: This is the name of the environment variable we want to get the value of.It returns the value of the environmental variable name. If it’s not found or if it doesn’t exist, it returns nothing.
# create some environment variablesENV["G"] = "Google"ENV["N"] = "Netflix"ENV["A"] = "Apple"ENV["A"] = "Amazon"ENV["M"] = "Meta"ENV["FOO"] = ""# get values of some environment variablesputs ENV["G"]puts ENV["M"]puts ENV["FOO"]puts ENV["A"]