Difference between revisions of "Integer Divide Operator"

From GiderosMobile
(added another example)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<!-- GIDEROSOBJ:Integer Divide Operator -->
 
 
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]]<br/>
 
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]]<br/>
 
'''Available since:''' Gideros 2017.10<br/>
 
'''Available since:''' Gideros 2017.10<br/>
Line 7: Line 6:
 
Divide a number to a whole number.
 
Divide a number to a whole number.
  
a=b '''//''' c &emsp; put the integer result of divide 'b' by 'c' into 'a'
+
a=b '''//''' c, put the integer result of divide 'b' by 'c' into 'a'
  
 
=== Examples ===
 
=== Examples ===
'''Simple example'''
+
<syntaxhighlight lang="lua">
<source lang="lua">
 
 
a=b//c -- faster than a=math.floor(b/c)
 
a=b//c -- faster than a=math.floor(b/c)
</source>
+
</syntaxhighlight>
  
 
'''Make an integer out of any numbers'''
 
'''Make an integer out of any numbers'''
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
b=5.123
 
b=5.123
a=b//1 -- result: a=5 (unique to gideros!)
+
a=b//1 -- result: a=5 (unique to Gideros!)
</source>
+
</syntaxhighlight>
 
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
=== Methods ===
 
| style="width: 50%; vertical-align:top;"|
 
=== Events ===
 
=== Constants ===
 
|}
 
  
 
{{GIDEROS IMPORTANT LINKS}}
 
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 02:58, 1 December 2023

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.png
Available since: Gideros 2017.10

Description

Divide a number to a whole number.

a=b // c, put the integer result of divide 'b' by 'c' into 'a'

Examples

a=b//c -- faster than a=math.floor(b/c)

Make an integer out of any numbers

b=5.123
a=b//1 -- result: a=5 (unique to Gideros!)