Main is a special function (#5) that is the entry point of the program which is declared outside of any class. Inside, it is the same as any other function. It is declared by the main keyword like so:
main {
}
Parameters can also be specified for main, but these must be of the string type or any type that can be converted from a string.
main(arg1: String, arg2 : Int) {
}
Note that main cannot have generic parameters (#9).
Overview
Main is a special function (#5) that is the entry point of the program which is declared outside of any class. Inside, it is the same as any other function. It is declared by the
main
keyword like so:Parameters can also be specified for
main
, but these must be of the string type or any type that can be converted from a string.Note that
main
cannot have generic parameters (#9).