View Single Post
use of variables
Status: Online
Posts: 175
Join Date: Jan 2007
Default use of variables - 10-16-2020, 12:31 PM

I am going to assume that you are riding this myFirstMethod...

Create two variables in myFirstMethod, by dragging the variable tile at the bottom of the screen to the beginning of myFirstMethod.

1) set the valueType of each to DecimalNumber
2) name one attempts, and the other correct
3) set the initializer value of each 0.0

Every time that a question is displayed, increase the attempts variable by 1
1) drag the assign tile into the appropriate place in your code
2) select attempts -> attempts from the menu that appears
3) click on the attempts tile on the right-hand side of the <- operator
4) from the drop-down menu select Math
5) from the submenu that appears select attempts + ???
6) from the next submenu select 1.0

Repeat this process for the correct variable in the appropriate part of your code

After you have finished asking all the questions.

Create another variable, results, and store the correct / results value

Then display this results variable as part of a say statement

Let me know if you have any more questions.

All the best,
Don Slater

Don Slater
Alice Team
Carnegie Mellon University
Reply With Quote