8-10 yrs old

11-13 yrs old

14-18 yrs old

Computer Science


Learn more how to use Variables in blocks, JavaScript and Python with MakeCode Coding Editor.

avatar Submitted By: Minecraft Education

October 12, 2020


  • Creativity
  • Critical Thinking

Learning Objectives

  • Learn to collect appropriate resources that are sustainable within a given biome.
  • Learn to manipulate variables in the provided code to control/direct the agent.
  • Learn how to use the agent to produce a structure that is sustainable within a given biome.
  • Utilize the following NGSS standards: HS-ESS3-3 EARTH AND HUMAN ACTIVITY
  • Utilize the following CSTA standards: 1A-AP-09, 1A-AP-11, 1B-AP-09
  • Utilize the following ISTE standards: 1C, 4A, 5A

Guiding Ideas

These learning activities are designed to provide the learner with flexibility and choice in his/her learning.

The learner will be introduced to three tutorials that are at three levels of difficulty (Novice, Intermediate and Expert) which are followed by an educational activity where he/she can apply coding skills.

Within each tutorial, the learner will have the option of selecting a coding language (Blocks, JavaScript or Python).

The learner may choose a tutorial at his/her appropriate difficulty level and language OR choose to complete all tutorials and the educational activity.  It will take approximately an hour to complete all activities.


  • Can you define sustainability?

The ability to exist constantly.

In the 21st century, it refers generally to the capacity for the biosphere and human civilization to coexist.

Sustainability focuses on meeting the needs of the present without compromising the ability of future generations to meet their needs.

  • Can you give an example of sustainability?

The Rain Forest is disappearing at an alarming rate which is having a dramatic impact on the rivers due to the large amounts of the soil now being washed into the rivers, killing fish and other aquatic life which has a direct impact on those who depend on the fish for their food source, including people.

As populations increase and cities expand to try to keep pace, farmland is lost, food production decreases and the increasing population runs the risk of running out of food.

Building a home in the desert out of blocks of ice would not be sustainable however, the same ice block home in the Arctic would be easily sustainable.

  • Can you define the term variable in coding (computer science)? Can you give an example of a variable in coding (Computer Science)?

A variable represents the place in memory for the data that’s kept there. It’s called a variable because the data it represents may change (vary) when the program stores something new there. 

Examples include, x, y, z, count, index, looping.

  • How can/does a player use variables in Minecraft? Can you give an example?

Variable block command; set x to 2Use the Block Editor variable statement to create a variable and the assignment operator to store something in the variable. This is called declaring the variable.

  • How can using variables help your game play in Minecraft?

Executing repetitive actions in Minecraft is time consuming. Using variables in combination with loops allows the player to execute complex instructions with much les player interaction, working more efficiently and accomplishing more in less time. Let the agent build your walls while you tend to the chickens. 

Student Activities

TUTORIAL 1: MEGA JUMP (Novice-10 minutes)

Main objective: The learner will utilize the teleport command and coordinates to cause their player to jump great distances.

Answer Key:

TUTORIAL 2: BAT CAVE (Intermediate-15 minutes)

Main objective: The learner will utilize repeat and fill commands to create an underground space and then spawn bats into that space.

Answer Key:

TUTORIAL 3: LETTER PRINTING (Expert-20 minutes)

Main objective: The learner will create and implement several variables to produce block printed letters and words at desired locations.

Answer Key:


Subject Area: Science

The learner will visit several different locations where they will assess the available resources and then collect items to use in a final build.

The learner’s challenge is to determine which items to collect so that when they return to build site, they will be able to supply the provided code with the necessary variables with which to build a sustainable dwelling.

The world has four unique locations and a Start and Finish location that are the same. The other four locations have several items available (4-5) each, but only 1 or 2 are useful at the build site.

Learner will first evaluate the starting location based on weather/biome conditions/available resources, topography, etc.

Learner will then visit each remaining location, one at a time, collecting resources for a build at the final location.

Learner will return to the build site and use a “starter code” that includes an Agent or Builder with the code to build a simple structure (cabin) out of the materials they picked up along the way.

The concept of Sustainability will be supported by introducing variables as parameters for the “structure” they build at their starting/finishing location as they use the provided build code but modify the:

NUMBER of blocks for the “length”, “width”, “height” of the structure (based on how many they collected on their journey). “Type” of blocks used in the structure (only from the ones they collected & contributes to the design of the structure itself). Coordinates of the build site (x, y, z) such that the structure actually fits (is physically sustainable on the site)

Outcome of this activity:

The learner will have successfully made decisions about what type of blocks to pick up, how many, and where to place them on the build site.  They do this by manipulating the stated variables (length, width, height, type and (x, y, z) coordinates) in the provided code.  The resulting build will be determined by the decisions they make, which is a core component of the concept of Sustainability.

Possible Solution for this Activity is attached.

Performance Expectations

Ask the leaners about the skills that they have practiced during the lesson to reinforce the concepts.

  • Name some of the variables used in this lesson.

(length, width, height, type and (x, y, z) coordinates)

  • What is a variable in coding/Computer Science?

Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves.

  • What is Sustainability? (as it relates to natural resources, weather, economy, etc.)

Sustainability is about making decisions with regard to natural resources, weather, economy, etc. that enable us to continue to exist over time without destroying our local environment (planet).

  • In what way were the variables (length, width, height, type and (x, y, z) coordinates) in this activity constrained (affected) by sustainability?

The limited number of blocks determined how large the structure could be. This limited the (length, width, height). The topography of the build site determined where it was safe to build (x, y, z) coordinates. The (type) of blocks collected directly affected the design of the final build.


  • Creativity
  • Critical Thinking