"Sputnik" help  
Sputnik Help
Float(<value>)

Description

Converts the specified value to a floating-point number. If the value is already a float, it returns it as is. If the value cannot be feasibly converted to a float within the scope of this function, it returns null.

Parameters

<value> The value to be converted to a floating-point number.

Return Value

Success: Returns true.
Failure: Returns false.

Remarks

The Float function aims to convert the input value to a float. If the conversion is successful, it returns the float representation; otherwise, it returns null.

Related

Casting, IsVarFloat

Example

Example of usage:

my $result = Float(42);
say $result;
// PRINTS
// 42.0

my $result = Float("3.14");
say $result;
// PRINTS
// 3.14

my $result = Float("Hello");
say $result;
// PRINTS
// 0

Casting:

my $result = (Float)"42.55";
say $result;
// PRINTS
// 42.55

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org