pxt-calliope/docs/reference/js/lessons/transformers/quiz.md
2016-04-13 08:27:45 -07:00

1.1 KiB

transformers quiz

Use functions to return values.

Name

Directions

Use this activity document to guide your work in the transformers tutorial

Answer the questions while completing the tutorial. Pay attention to the dialogues!

1. What is a 'function'?


2. Write the line of code to create a number variable called x that is equal to 5.


3. Write the line of code to create a condition for 'on button pressed ("A")'


4. Write the steps to create a function.


5. Create a function called double that will double whatever input parameter is passed into it.


6. Consider the following directions. Call the function that doubles the variable original. The function is going to return the doubled value after it is called. Assign the new value (10) to a variable which we will call doubled.


7. Refer to Question 6. Write the code to call the function that doubles our new variable doubled. Assign the new value 20 to a variable we will call doubled twice.