val list: List[Any] = List(
732, // an integer
'c', // a character
true, // a boolean value
() => "an anonymous function returning a string"
list.foreach(element => println(element))
Is the supertype of all types, also called the top type. Any has two direct subclasses: AnyVal and AnyRef.
AnyVal represents value types. There are nine predefined value types and they are non-nullable: Double, Float, Long, Int, Short, Byte, Char, Unit, and Boolean. .
AnyRef represents reference types. All non-value types are defined as reference types. Every user-defined type in Scala is a subtype of AnyRef. .