Scala Float toFloat() method with example
Last Updated :
29 Oct, 2019
The toFloat() method is utilized to converted the specified number into float value.
Method Definition: (Number).toFloat
Return Type: It returns the converted float value.
Example #1:
object GfG
{
def main(args : Array[String])
{
val result = ( 9 ).toFloat
println(result)
}
}
|
Example #2:
object GfG
{
def main(args : Array[String])
{
val result = ( 0 ).toFloat
println(result)
}
}
|
Example #3:
object GfG
{
def main(args : Array[String])
{
val result = ( 4.7 ).toFloat
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...