Scala Int toFloat() method with example
Last Updated :
04 Feb, 2020
The toFloat() method is utilized to convert the specified int number into float data type value.
Method Definition: (Number).toFloat
Return Type: It returns the converted float datatype value.
Example #1:
object GfG
{
def main(args : Array[String])
{
val result = ( 1 ).toFloat
println(result)
}
}
|
Example #2:
object GfG
{
def main(args : Array[String])
{
val result = ( 12 ).toFloat
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...