U4Ch1L3_Variables Practice
Purpose: Students will practice using the skills and processes they have learned about variables.
Activity: Log on to U4Ch1L3 – Practice using all the skills you have learned.
Level 2: Variable Rules- There are a few Rules for Variables Names:
Level 3: Variables & Operators
Level 4: Variable in Expressions
Var. Hint:
- Variables can be created and assigned using a single command, like var myAge = 16.
- You can use variables in an expression, like myAge + 1. but 2var is not.
Level 5: Expressions: Joining Two Strings
Hint:
The + operator can be used to join two strings or a number and a string.
- "sun" + "rise" evaluates to "sunrise"
- "4" + "ever" evaluates to "4ever"
- The \n character ("new line character") will make a string print across multiple lines.
Do This:
- Run the program to see what it does.
- Write code to answer the last two questions. Join the strings to make your responses print on a single line.
Level 6: Counting with Numbers
Hint:
The counter pattern is myVar = myVar + 1. The expression on the right myVar + 1 is evaluated first. The new value is then assigned to myVar. This pattern lets a variable "count" by whatever amount is added.Do This:
- Write code to make the "+$20" button work.
Level 7: Counting with Strings
Hint:
The counter pattern can be used with strings too.
Do This:
- Note a new block: getText() on line 14.
- Add code so that each reminder is added to a different line on the screen. Remember the new line character is \n.
- Add code so that the reminder input is cleared out when you click the Remind! button.
Level 8: Global vs. Local Variables
Level 9: Applying Your Variable Skills
Do This:
- Edit the three Apps using your new skills!