scala> def pageVisitCount(session: Int): Int = session + 1
pageVisitCount: (session: Int)Int
scala> var totalPageCount = pageVisitCount(1)
totalPageCount: Int = 2
scala> def message() = "Hello Scala"
message: ()java.lang.String
scala> message()
res0: java.lang.String = Hello Scala
scala> message
res1: java.lang.String = Hello Scala
Even you can able to call function without parenthesis if it doesn't have arguments.
No comments:
Post a Comment