Hello. I declared a variable in AppLab to hold the value of how many times a checkbox has been clicked. However, instead of adding 1 to the value, I am getting N as the output. When I was getting 1 for the output, it wouldn’t go beyond 1. Adding some additional steps to the checkbox.clicked code gives me the N output, though.
The code I did would work in AppInventor or many other programming languages. But, it seems like App Lab doesn’t respond the same way to the code. Any thoughts would be greatly appreciated. The code is below. Thanks.
onEvent(“button1”, “click”, function( ) {
setScreen(“screen2”);
});
onEvent(“checkbox1”, “click”, function( ) {
var Nike;
var Nike = Nike + 1;
setText(“label5”, Nike);
if (Nike >= 1) {
setText(“label7”, “Enjoy the Nikes”);
} else {
setText(“label7”, “No Nikes?”);
}
});
onEvent(“dropdown2”, “change”, function( ) {
var dropdown_Value = getProperty(“dropdown2”, “value”);
setScreen(dropdown_Value);
});