Choose a Line explainer


#1

The aim of this puzzle: Add an if statement so that something prints out for both RightLine or LeftLine.

Walkthrough of the solution: To solve this puzzle another if statement needs to be added. Tap at the bottom of the code to bring up the keyboard, then tap the if key. Inside the if statements test (), check if the answer variable has been assigned 'RightLine', using answer === 'RightLine'. Then, inside the block {} of the if statement add a print() function and print out a message about the speed of the RightLine.

Sample code solution:
(Tap below to reveal)

var answer = pickRandom([
    'LeftLine',
    'RightLine'
]);
if (answer === 'LeftLine'){
    print('You picked the LeftLine, but it moved slower')
}
if (answer === 'RightLine'){
    print('You picked the RightLine, but it moved slower')
}

JavaScript Concepts: Calling Functions, Data Structures (Arrays), Identifiers, Variable Declaration, Strings, Control Flow (If Statements)
Grasshopper Concepts: pickRandom(), print()