Forum Discussion

JeanMarrapodi-c's avatar
JeanMarrapodi-c
Community Member
6 days ago

Variable change when user upates an answer?

I'm trying to build a course to help our users count money. I've done all the coding and all the math so everything works EXCEPT if they make a mistake and change a number to correct it. Then it adds...
  • JudyNollet's avatar
    6 days ago

    As you've discovered, you have to be very careful about when you perform math operations on a number variable. 

    There's a simple solution to your problem: reset the Total, and then add all of the variables every time the user edits one of the "How many..." fields. 

    And a simple way to do that: Every time one of those variables changes, show a "counting" layer. Don't put any objects on that layer. Just do the math, and close it. 

    This is shown in an edited version of your slide in the attached file.

    FYI: Here's more info about using invisible layers: TIP: the Incredible Power of Invisible Layers | Articulate - Community