Home »
Code Examples »
Scala Code Examples
Scala - Floating-point literals (Double and Float) Code Example
The code for Floating-point literals (Double and Float)
val var_hex: Int = 0x0AF //Hexadecimal
val var_dec: Int = 108 // Integer
//The L at the end is for Long
val var_hex1: Long = 0x0FAFCFEL // Long in Hex format
val var_dec1: Long = 1234567L // Long
// Printing the vallues
println(var_hex)
println(var_dec)
println(var_hex1)
println(var_dec1)
/*
Output:
175
108
16448766
1234567
*/
Code by IncludeHelp,
on August 10, 2022 10:16