How do I use math inside of a variable set function?

  • not sure how to go about typing this:

    (GlobalNumberN - CountIDLimitMax) > 0 ? (GlobalNumberN + CountIDLimitMax) > CountIDLimitMax ? CountIDLimitMax + GlobalNumberN[/code:2e86wj3m]
    
    giving me some error about expecting a " : " for comparison or something. I had made a Min and Max value but I wanted to see if I could do it without having to declare a Min variable (which is easy and works).
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The ? character is the beginning of a conditional operator. It's an if, then statement. It is used like this:

    condition ? result if condition is true : result if condition is false

    Your statement says:

    IF (GlobalNumberN - CountIDLimitMax) > 0 then

    IF (GlobalNumberN + CountIDLimitMax) > CountIDLimitMax then

    CountIDLimitMax + GlobalNumberN

    but it is missing bolth ELSE statements which are started by the : symbol.

    What exactly are you trying to do with this statement?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)