[thelist] [JS] Modulo Operator question

Judah McAuley judah at wiredotter.com
Mon Mar 29 14:39:05 CST 2004


Tom Dell'Aringa wrote:
> I know that the modulo gives you the remainder from a division of
> var1 and var2:
> 
> var Mod = var1 % var2; // would give me the remainder of this
> expression
> 
> Question is - is the remainder number *always* a integer? It seems to
> be wherever I see it used, but I wanted to make sure.

Yes, its always an integer. So 5%2 = 1 because 5/2 is 2 remainder 1.

Note that modulo only works if you are dividing two integers.

Judah



More information about the thelist mailing list