Int: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
''This function is for BASIC compatibility. It is not available in pure JavaScript projects.''
Int(''number'')
Int(''number'')


Line 15: Line 17:
Print "Int(pi) = " & Int(Pos)
Print "Int(pi) = " & Int(Pos)
Print "Int(-pi) = " & Int(Neg)
Print "Int(-pi) = " & Int(Neg)
</pre>
== Example (JavaScript) ==
<pre>
// Int Example
/* ParseInt converts floats to the next smallestint */
var Pos, Neg;
Pos = Math.atan(1) * 4;
Neg = -Pos;
NSB.Print("parseInt(pi) = " + Math.floor(Pos));
NSB.Print("parseInt(-pi) = " + Math.floor(Neg));
</pre>
</pre>



Revision as of 18:07, 24 March 2019

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

Int(number)

Description

Int removes the fractional part of a number, returning the next smallest integer. The required parameter, number, is any valid numeric expression.

Example (Basic)

Rem Int Example
'Int converts floats to the next smallestint
Dim Pos, Neg
Pos = Atn(1) * 4
Neg = -Pos
Print "Int(pi) = " & Int(Pos)
Print "Int(-pi) = " & Int(Neg)

Output

Int(pi) = 3
Int(-pi) = -4

Related Items

Fix