1

I've been working with Spark having just a basic understanding of Scala and I noticed that I can do both

df.groupBy("c1").count.show

and

df.groupBy("c1").count().show()

Both will produce the same result. When can I use parenthesis for function calls and when can I not? What is the reason for this?

Arjunlal M.A
  • 119
  • 6
  • @werner So, would my example be infix, postfix or prefix? – Arjunlal M.A Sep 23 '21 at 16:01
  • 3
    If a a no parameter method is defined as `def abc(): String` then it can be used as either `abc()` or just `abc`. But, if this was defined as `def abc: String` then it can only be used as `abc`. – sarveshseri Sep 23 '21 at 16:33

0 Answers0