First, under the SRC under main under Scala create a package for org.scala.base
Create a Scala class name of HELLOWORLD.SCLA
Because the main method is to be in the object, we create an object name called HelloWorld and add the main method and print a line of content
Next we add a method to the object: Printlnhello;
Ps:
1. The value of the last line of the function body is the return value of the entire function.
2. The Declaration of type is at the back of a variable or function or class
Another way to define a method:
When the method or function is parameterless, we can omit the parentheses when calling
Next we define an anonymous function and call
The Keli of Scala's function programming, this feature allows the function to be defined with two parentheses:
Scala Variable parameter usage:
Scala method Default Parameters:
Getting started with Scala-02 Basics--Method