7. 可見性修飾符 Visibility Modifiers
• If you do not specify any visibility modifier, public is used by default,
which means that your declarations will be visible everywhere;
• If you mark a declaration private, it will only be visible inside the file
containing the declaration;
• If you mark it internal, it is visible everywhere in the same module;
• protected is not available for top-level declarations.
10. Unit函數
Function returning no meaningful value
fun printSum(a: Int, b: Int): Unit {
println("sum of $a and $b is ${a + b}")
}
fun printSum(a: Int, b: Int) {
println("sum of $a and $b is ${a + b}")
}