Lab Write Up

Name: Elijah Levy

Period: 7

Assignment: Lab 4

Lab Overview

This lab focused on the use of variables to solve several problems in scratch.

Questions

  1. Are variables in computer programming the same as variables in math class? Why or why not?
    • Yes, in some ways. Usually, in math, the goal of the problem is to solve for the variable. In programming, variables are tools you can use to solve problems.
  2. When creating a variable, what are the two types of scope a variable can have?
    • In Scratch, a variable can either contain a real number or a value of true or false.
  3. How many values can a variable store at one time?
    • In Scratch, one variable stores one value.
  4. What will the following code snippet do? Explain why it doesn’t work as intended.
    • The code snippet shown will set variable1 to variable2, but then sets variable2 to itself instead of variable1's previous value.
  5. Given the following code snippet, explain what is happening.
    • The code snippet swaps the values of variable1 and variable2