So I've been trying to puzzle through the various ways you can define stuff in Scala, complicated by my lack of understanding of the way {} blocks are treated:
object NewMain extends Thing{
    def f1 = 10
    def f2 {10}
    def f3 = {10}
    def f4() = 10
    def f5() {10}
    def f6() = {10}
    def f7 = () => 10
    def f8 = () => {10}
    def f9 = {() => {10}}
    def main(args: Array[String]){
        println(f1)     // 10
        println(f2)     // ()
        println(f3)     // 10
        println(f4)     // 10
        println(f4())   // 10
        println(f5)     // ()
        println(f5())   // ()
        println(f6)     // 10
        println(f6())   // 10
        println(f7)     // <function0>
        println(f7())   // 10
        println(f8)     // <function0>
        println(f8())   // 10
        println(f9)     // <function0>
        println(f9())   // 10
    }
}
Presumably some of these are equivalent, some of these are syntactic sugar for others, and some are things I should not use, but I can't for the life of me figure it out. My specific questions are:
- How is it that - println(f2)and- println(f5())gives- unit? Isn't the last item in the block- 10? How is it different from- println(f3()), which gives- 10?
- If - println(f5)gives- unit, shouldn't- println(f5())be invalid, since- unitis not a function? The same applies to- println(f6)and- println(f6())
- Of all the ones which print 10: - f1,- f3,- f4,- f4(),- f6,- f6(),- f7(),- f8(),- f9(), is there any functional difference between them (in terms of what it does) or usage differences (in terms of when I should use which)? Or are they all equivalent?
 
     
     
     
    