How do I make a counter where I can go up to 15 and then it caps there

I want to make a counter where there is a plus and minus at the bottom and the number box up top. How do I create it? I want to be able to keep adding til 15 then it stops because that is the cap.

Assuming that the plus and minus are buttons, you can use the button's enabled property.

Whenever the plus button is clicked, you can use an if condition to check whether you count is equal to 15 or not. If it reaches 15, set the plus button's enabled property to false.

But, that won't be the ideal solution.
This logic should work better.

Whenever the plus button is clicked, you can use an lesser than condition to check whether you count is equal is less than 15 or not. If it less than 15 (true), then set the plus button to enabled. If the condition is false, i.e. it has reached 15, set the plus button's enabled property to false.

1 Like