Oct: Difference between revisions

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


'''Description'''
== Description ==


OCT returns a string representation of the octal (base 8) value of a number. The required parameter, ''number'', is any valid numeric expression. If ''number'' is not a whole number, it is rounded to the nearest whole number before being converted.
Oct returns a string representation of the octal (base 8) value of a number. The required parameter, ''number'', is any valid numeric expression. If ''number'' is not a whole number, it is rounded to the nearest whole number before being converted.


'''Example'''
== Example (Basic) ==


<pre>
<pre>
REM OCT Example
Rem Oct Example
'OCT returns a number as an octal string
'Oct returns a number as an octal string
PRINT "68 in octal:", OCT(68)
Print "68 in octal:", Oct(68)
PRINT "1 in octal:", OCT(1)
Print "1 in octal:", Oct(1)
PRINT "2605.45 in octal:", OCT(2605.45)
Print "2605.45 in octal:", Oct(2605.45)
</pre>
</pre>


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


<pre>
<pre>
Line 23: Line 24:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[hex|HEX]]
[[hex|Hex]]
 
[[Category:Language Reference]]
 
[[Category:Strings]]
 
[[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. Oct(number)

Description

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

Example (Basic)

Rem Oct Example
'Oct returns a number as an octal string
Print "68 in octal:", Oct(68)
Print "1 in octal:", Oct(1)
Print "2605.45 in octal:", Oct(2605.45)

Output

68 in octal:  104
1 in octal:   1
2605.45 in octal:    5055

Related Items

Hex