Bin Function

Returns a FixStr (String) value representing the binary value of a number.

Syntax

Bin[$]([number])

The optional number argument is any valid numeric expression or string expression in the range from -2147483648 to 2147483647. If this argument is omitted, is a non-initialized variable, or Null, the function returns 0.

Remarks

If number is not already a whole number, it's rounded to the nearest whole number before being evaluated. If number is Empty or Null, the function returns 0. For any other number the Bin function returns up to 32 binary symbols.

You can represent binary numbers directly by preceding numbers in the proper range with &B. For example, &B10 represents decimal 2 in binary notation.

The Bin$ returns String values. The Bin form returns FixStr values.

Example

Dim MyBin
MyBin = Bin(5)   ' Returns 101.
MyBin = Bin(10)   ' Returns 1010.
MyBin = Bin(459)   ' Returns 111001011.

 

See Also

Oct Function,Hex Function,Type Conversion Functions