Scala – Tuples




// Scala - Tuples 
object Demo {
  val mytuple = (1, 2, "hello", true);
  val mytuple2 = new Tuple3(1, 2, "hello");
  val mytuple3 = new Tuple3(1, "hello",  (2,3));
	def main(args: Array[String]) {
		println(mytuple._1);
		println(mytuple._2);
		println(mytuple._3);
		println(mytuple._4);
		println(mytuple2._3);
		
		mytuple.productIterator.foreach{
		  i => println(i);
		}
		
		
		println(1 -> "Tom" -> true);
		println(mytuple3._3._2);
	}
}

/*
OUTPUT:
1
2
hello
true
hello
1
2
hello
true
((1,Tom),true)
3

*/

 


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com





1 Comment

  1. did you know result of is often lend you flash to another person..? so when mencolokkkan the flash is a virus that is contracted from someone else’s computer to our computer.

    Not to be confused! https://getsmadav.com provides antivirus smadav to prevent the spread of computer viruses. please download the latest version in our web Smadav 2019

Leave a Reply

Your email address will not be published.


*