I only want this block to run whenever the button which says Add 10 points
is hit - currently it runs all the time for some reason!
the block is under the need help
heading!
thanks
I only want this block to run whenever the button which says Add 10 points
is hit - currently it runs all the time for some reason!
the block is under the need help
heading!
thanks
Welcome to the forums @jajoosam!
Here’s a quick fix:
total
. For mutable
variables, recall that mutable total
is a non-reactive reference and total
is a reactive one (meaning that when mutable total
is changed, all cells that reference total
will be re-run). The fix was just to replace total
with mutable total
viewof toAdd
button to work by adding a reference to toAdd
in the “need help” cell. The way views work, clicking on the button causes the button to dispatch an input
event, which causes the runtime to re-evaluate all cells that depend on toAdd
.