Hello! I’m a part-time teacher trying to teach some intro-level coding concepts to high school students. I’ve become stumped with assigning values to variables. Please help.
The app is a simple encyclopedia-type application to show my students how to work with variables and event handlers, but I can’t seem to assign a new value to a variable:
The block causing issues is the “set app variable rowNumber to index”. I played around with it, and can confirm that the index is a number, but when it’s set using the “set” block it doesn’t seem to take? I’ve tried initializing the rowNumber to an number data type, but this did not change anything.
If you’d like a closer look: Thunkable
Any help is appreciated. Thank you, in advance!
Hi and welcome to Thunkable! I teach in a K-8 school makerspace and offer an elective in app design with Thunkable.
It’s easier to use the automatically-generated variable name blocks rather than the editable name blocks. That’s kind of a mouthful so…
Instead of this:
The reason your blocks did not work is because you were asking Thunkable to set the variable named “1” or “2” or whatever the index value is. That “name” field is for the name of a variable but you gave it a variable (not a name) and that variable happens to have a numeric value.
I’ve used Thunkable for over a year without ever using that second type of variable block. It’s not that it’s not useful in certain situations but… I rarely find a need and I definitely find it error-producing because the onus is on me to type the name correctly.
Thank you! I completely misunderstood that coding block.