Hex: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
Created page with "HEX(''number'') '''Description''' HEX returns a string representation of the hexadecimal (base 16) value of a number. The required parameter, ''number'', is any numeric expr..."
 
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
HEX(''number'')
''This function is for BASIC compatibility. It is not available in pure JavaScript projects.''  


'''Description'''
Hex(''number'')


HEX returns a string representation of the hexadecimal (base 16) value of a number. The required parameter, ''number'', is any numeric expression. If number is not a whole number, it is rounded to the nearest whole number before being converted.
== Description ==


'''Example'''
Hex returns a string representation of the hexadecimal (base 16) value of a number. The required parameter, ''number'', is any numeric expression. If number is not a whole number, it is rounded to the nearest whole number before being converted.
 
== Example (Basic) ==


<pre>
<pre>
REM HEX Example
Rem Hex Example
'HEX returns a number as a hexadecimalstring
'Hex returns a number as a hexadecimalstring
PRINT "68 in hex:", HEX(68)
Print "68 in hex:", Hex(68)
PRINT "1 in hex:", HEX(1)
Print "1 in hex:", Hex(1)
PRINT "2605.45 in hex:", HEX(2605.45)
Print "2605.45 in hex:", Hex(2605.45)
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 23: Line 25:
</pre>
</pre>


'''Related Items'''
== Related Items ==
 
[[oct|Oct]]
 
[[Category:Language Reference]]
 
[[Category:Strings]]


[[oct|OCT]]
[[Category:BASIC Functions]]

Latest revision as of 15:26, 25 March 2019

This function is for BASIC compatibility. It is not available in pure JavaScript projects.

Hex(number)

Description

Hex returns a string representation of the hexadecimal (base 16) value of a number. The required parameter, number, is any numeric expression. If number is not a whole number, it is rounded to the nearest whole number before being converted.

Example (Basic)

Rem Hex Example
'Hex returns a number as a hexadecimalstring
Print "68 in hex:", Hex(68)
Print "1 in hex:", Hex(1)
Print "2605.45 in hex:", Hex(2605.45)

Output

68 in hex:    44
1 in hex:     1
2605.45 in hex:      A2D

Related Items

Oct