Command Line Arguments

Command-line arguments are values or options that you can pass to a program when you launch it via command line(or terminal). They allow you to control the behavior of the program from outside, rather than hardcoding values directly into the code.

Before passing command-line arguments, the main function in your code must take one variable of type 'List'.

{
    name : Main
    args: (List __arglist)
    println("Arguments : ", __arglist)
}

After succesfull compilation of your source code, you can pass command line arguments like this:

INPUT

    sron 1 2 3 4 5

OUTPUT

Arguments : [1, 2, 3, 4, 5]

Last updated