# Gone Solo explainer

#1

The aim of this puzzle: Build a band-name generator that outputs at least 9 different band name options.
Walkthrough of the solution: This puzzle features a “nested” for loop, which is a for loop inside another for loop.

For each iteration of the outer for loop, the inner for loop iterates completely. For example:

``````for (var a of [0, 1]) {
for (var b of [0, 1, 2]) {
print(a, b);
}
}
``````

When the code runs, this will print:
`0,0`
`0,1`
`0,2`
`1,0`
`1,1`
`1,2`

In this puzzle, we will use a nested for loop to generate band names. To complete the puzzle, add 2-3 names to the outer for loop’s array, and 2-3 names to the inner for loop’s array.
Sample code solution:
(Tap below to reveal)

``````for (var artist of ['Grace', 'Iggy', 'Summer', 'Josie']) {
for (var band of ['Grasshoppers', 'Bugs', 'Cheese', 'Mechs']) {
print(artist + ' and the ' + band);
}
}
``````

JavaScript Concepts: Data Structures (Arrays), Code Block (for loop), Loops, Variable Declaration, Binary Expression (+), Calling Functions, Identifiers
Grasshopper Concepts: print()

listed #2