Wednesday, 7 August 2013

How to get the largest integer smaller than or equal to a given number in corona SDK

We can find out the largest integer smaller than or equal to a given number using math.floor(). 

Syntax:
   
    math.floor()
   
Example:

    print(math.floor(0.5))    --->     0
    print(math.floor(-0.5))  --->     -1

No comments:

Post a Comment