Mystic Software Forums

Mystic Software => General Discussion => Topic started by: Number Eight on March 14, 2005, 08:14:37 PM

Title: (no subject)
Post 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.
Title: (no subject)
Post by: Xorlak on March 14, 2005, 09:50:13 PM
Hmmm, TK2 doesn't have a modulo command...

Let's see...

Code: [Select]
#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.
Title: (no subject)
Post by: Colin on March 15, 2005, 12:42:45 AM
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!
Title: (no subject)
Post by: Dude Man on March 15, 2005, 11:12:39 AM
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*
Title: (no subject)
Post by: Number Eight on March 15, 2005, 03:26:44 PM
Xorlak: Thanks for that method. You'll be in the credits Wink

 Dude Man: NO! You shall never see! *hides computer*