create a charades game with a collection of strings.
Use this activity document to guide your work in the headbands tutorial.
Answer the questions while completing the tutorial. Pay attention to the dialogues!
A 'collection' is a group of variables of the same type stored together. A 'collection' of strings is a group of strings stored together.
let coll: string[] = []
coll.push("puppy")
coll.push("clock")
Write the line of code that will display the string "puppy" using ||variables:coll||
.
let coll: string[] = []
basic.showString(coll[0])
let coll: string[] = []
coll.push("puppy")
coll.push("clock")
coll.push("cat")
Write the line of code that will display the string "cat" using ||variables:coll||
.
let coll: string[] = []
basic.showString(coll[2])
let coll: string[] = []
Write the five (5) lines of code that will add the following five words to ||variables:coll||
: "puppy"
, "clock"
, "night"
, "cat"
, and "cow"
.
let coll: string[] = []
coll.push("puppy")
coll.push("clock")
coll.push("night")
coll.push("cat")
coll.push("cow")
let coll: string[] = []
let index = Math.randomRange(0, coll.length)
let word = coll[index]