Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Idiom # 60: Read command line argument

See programming-idioms.org:

Since Fuzion does not have global variables, the command line arguments are implemented as an effect with a default implementation that returns the arguments provided to the application:


Running Example

The simple example printing the first argument will cause an error if called without an argument:

With arguments implemented as an effect, code that accesses the arguments will be detected by the fuzion tool, the access will be reported as a side-effect. Furthermore, it is possible to create new environments and call code with different argument lists, as shown here:

Running Example