How to tell if a number is even or odd

MammothMammoth Member Posts: 640
edited November -1 in Working with GS (Mac)
Usually when I try to tell if a number is even or odd I check to see if it can be devisable by 2.

Is there a way to do this in Game salad?

Thanks :)

Comments

  • devjohnsondevjohnson Member Posts: 94
    Change an attribute value equal to the attribute you are checking value % 2

    Then check if the attribute is 0 or 1. If it is 1, it is odd, 0 it is even.

    game.check = game.valuetocheck % 2

    if game.check = 1
    This is odd
    else
    This is even
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    Attribute%2 = 0
    Do something

    Attribute % 2 will treturn a 0 or 1
Sign In or Register to comment.