Mystic Software Forums
Mystic Software => General Discussion => Topic started by: Number Eight on March 14, 2005, 08:14:37 PM
-
Is there a way I can code a method to find out whether a number is even or odd in TK2?
Thanks for any help.
-
Hmmm, TK2 doesn't have a modulo command...
Let's see...
#method iseven(number!)
{
#even! = 0
#half! = number! / 2
#castint(half!, test!)
#if(half! == test!){#even!=1}
}
That will set 'even!' to 1 if 'number!' is even, 0 if it's odd.
-
TK3 has the C % operator. *grin*
...as well as the complete C++ operator set (not without the scope resolution operator, of course Smile)
Switch now!
-
I believe he's been saying that he can't use TK3 for the past year.
Stop trying to convert everyone to TK3 with your evil propaganda!
TK2 4 evr!!!1 Razz
I'm kidding TK3 is awsome. Wink
Anyways, that looks like a dandy method Xorlak, I wonder, what Number Eight needs it for. *puts on black jumpsuit and places spy cams in #8's house*
-
Xorlak: Thanks for that method. You'll be in the credits Wink
Dude Man: NO! You shall never see! *hides computer*