Scala - Access element using underscore method Code Example

The code for Access element using underscore method

object MyClass {
    def main(args: Array[String]) {
        var person = ("Tony Robbins", "62", "Los Angeles, California, U.S.", true)
        
        println(person._1)
        println(person._2)
        println(person._3)
        println(person._4)
    }
}

/*
Output:
Tony Robbins
62
Los Angeles, California, U.S.
true
*/
Code by IncludeHelp, on August 15, 2022 22:33

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.