Tag: Functions in scala

Array in scala enter form keyboard

This is function scala programer enter N element Interger form keyboard. Example: import scala.io._ object InputArray { def main(args: Array[String]): Unit = { println("Please enter n all element?") val n = StdIn.readInt() println("---------begin--------") val IntArr = Array.fill(n.toInt) { StdIn.readInt() } println("---------result--------") for (x <- IntArr) { println("x:" + x) } } } Reuslt:

Advertisements

Scala Data Type – Description

Sr.No Data Type & Description 1 Byte 8 bit signed value. Range from -128 to 127 2 Short 16 bit signed value. Range -32768 to 32767 3 Int 32 bit signed value. Range -2147483648 to 2147483647 4 Long 64 bit signed value. -9223372036854775808 to 9223372036854775807 5 Float 32 bit IEEE 754 single-precision float 6 Double … Continue reading Scala Data Type – Description