jaytea commented on a Page, $iseven - $isodd  -  Oct 27, 2007

not quite Olliegod :P $1 // 2 checks $1 is a factor of 2. you want the reverse, 2 // $1

there\'s lots of ways to accomplish this, FLCL\'s methods are probably amongst the worst i\'ve seen (sorry, just seems like you\'ve copied techniques without understanding them at all :P), here\'s quite possibly the shortest method:

alias iseven return $isodd($calc($1 -1))
alias isodd return $istok(1,$and($1,1),0)

there\'s a lot of other conditions you can use to check $1 is odd/even :P

if ($1 & 1) ; odd
if ($1 !& 1) ; even

if (1 \\\\ $calc($1 / 2)) ; odd
if (1 // $calc($1 / 2)) ; even

if ($calc($1 % 2)) ; odd
if (!$calc($1 % 2)) ; even

if ($1 == $or($1,1)) ; odd
if ($1 != $or($1,1)) ; even

and the list goes on :P

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.