• an automatically generated or user-defined name to refer to the computed value (res0, which means result 0),
• a colon (:), followed by the type of the expression (Int),
• an equals sign (=),
• the value resulting from evaluating the expression
If you’re not familiar with Java packages, you can think of them as providing a full name for classes. Because Int is a member of package scala, “Int” is the class’s simple name, and “scala.Int” is its full name. The resX identifier may be used in later lines. For instance, since res0 was set to 3 previously, res0 * 3 will be 9:
To print the necessary, but not sufficient, Hello, world! greeting, type:
scala> println("Hello, world!")
Hello, world!
The println function prints the passed string to the standard output, similar
to System.out.println in Java.
댓글 없음:
댓글 쓰기