E3003

E3003#

init and main function must have no arguments and no return value.

Note

The case of fn main() -> Unit is exceptionally accepted and can be corrected by the formatter.

Erroneous example#

///|
/// `init` function must have no arguments and no return value.
fn init() -> Unit {
   
}

///|
/// Error: Unused parameter list for the main function.
fn main() {
  println("Hello, world!")
}

Suggestion#

Remove the argument list and return type annotation, as:

///|
fn init {

}

///|
fn main {
  println("Hello, world!")
}