Day2

Day2

ValueRange.kt
fun main() { // Byte min & max value val maxByteValue = Byte.MAX_VALUE val minByteValue = Byte.MIN_VALUE println("Byte Minimum value is : $minByteValue") println("Byte Maximum value is : $maxByteValue\n") // Short min & max value val maxShortValue = Short.MAX_VALUE val minShortValue = Short.MIN_VALUE println("Short Minimum value is : $minShortValue") println("Short Maximum value is : $maxShortValue\n") // Int min & max value val maxIntValue = Int.MAX_VALUE val minIntValue = Int.MIN_VALUE println("Int Minimum value is : $minIntValue") println("Int Maximum value is : $maxIntValue\n") // Long min & max value val maxLongValue = Long.MAX_VALUE val minLongValue = Long.MIN_VALUE println("Long Minimum value is : $minLongValue") println("Long Maximum value is : $maxLongValue\n") }
this code uses built in function in kotlin to find out minimum value and maximum value each numeric datatype can store in that variable , for Byte and Short you need to set data type explicit otherwise it set Int as defualt