Magic Answers Explainer

Magic Answers Explainer

Aim of this puzzle Add the responses of an 8 ball and choose from them randomly.

Walkthrough of Solution: A list of responses is stored in an array [], to add to the list you have to add a new entry by tapping below the last response and above the closing square bracket - ]. Use the key ‘str’ to type a response like 'maybe' or 'outlook good'.

Example Solution of Code:

(Tap below to reveal)

var answer = pickRandom([

'yes',

'no',

'reply hazy',

'doubtful',

'outlook good'

]);

print(answer);

JavaScript Concepts: Data structures (arrays), variable declarations, function calls, identifiers

Grasshopper Concepts: pickRandom(), print()

1 Like

Where’s the ‘reset button’’. It keeps talking about

1 Like

The little circular button. most commonly used in “redo” features. It’s next to the ‘Run Code’ button.