Logo

Programming-Idioms

History of Idiom 205 > diff from v9 to v10

Edit summary for version 10 by Bart:
New Pascal implementation by user [Bart]

Version 9

2019-09-29, 20:59:52

Version 10

2019-09-29, 21:01:15

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Extra Keywords
envvar os system
Extra Keywords
envvar os system
Imports
sysutils
Code
var
  foo: string;
begin
  foo := GetEnvironmentVariable('FOO');
  if (foo = '') then foo := 'none';
end.