[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Language Syntax
- From: Coroutines <coroutines@...>
- Date: Mon, 23 Jun 2014 22:45:48 -0700
On Mon, Jun 23, 2014 at 10:43 PM, Choonster TheMage
<choonster.2010@gmail.com> wrote:
> Sticking with your existing technique:
> function modulus(n, d)
> local q = math.floor(n/d)
> return n - q * d, q
> end
>
> Using the modulus operator (I'm pretty sure this is correct):
> function modulus(n, d)
> return n % d, math.floor(n/d)
> end
In Lua 5.3 that would be:
function modulus(n, d)
return n % d, n // d
end
*tingles with anticipation*