Unit in Scala

    Unit means no interesting value is returned and is similar to Void in Java.

    Example:

    def greet(name: String) = println("Hello " + name)
    
    greet("TGB Learner")

    Output:

    def greet(name: String): Unit
    
    Hello TGB Learner

    Demonstration:

    Scala Unit example