You can create arrays of any data type to store more than one value at the same time like this:
String[] s1;. For a given array, all items must be of the same type. Read more about looping and accessing array items in the fundamentals section.Constructors
Float Float(Float value)
Pass aFloat to copy into a new object.
Float Float(Integer value)
Pass anInteger and have it converted to a Float object.
Float Float(Long value)
Pass aLong and have it converted to a Float object.
Float Float(String number)
Pass aString containing a decimal number. The constructor will parse the text and create a Float object.
Numeric strings
Strings can have numeric content but are always written in quotes.String toString(Integer decimals)
toString() is one of the most frequently used methods, typically when you are going to output something. It returns a string representation of a Float.
You must always specify how many decimal digits you want.
Math operators
Math functions
Float abs()
abs() will return the absolute value of a Float. That is, the non-negative value of the number without regarding the sign.
Integer floor()
floor() will return the Integer preceding the decimal separator. The floor of a Float is calculated by rounding downward to the nearest Integer.
Integer round()
round() will return the Integer approximation of the Float without any decimals. It is calculated by rounding to the nearest Integer.
- if the 1st decimal is 5, 6, 7, 8, or 9 - round up
- if the 1st decimal is 0, 1, 2, 3, 4 - round down
Zero vs. no value
Before a Float is initialized, it has no value. This is commonly written as NULL, NUL, or NIL.Bool isNull()
isNull() will return true if it has no value and false if it does.