Start learning free

LESSON 141 OF 671 · FOR LOOPS - LOOPING OVER ARRAYS

Looping Over Arrays: Buggy Code II in Go

Practice

Inside the code editor we've tried to write a for loop that prints a tailored message about every language in the languages array.

So when we ran the code, we expected it to print:

I think Python is cool!
I think Java is cool!
I think JavaScript is cool!

but it seems like we made some mistakes because Go refuses to compile it, reporting that language is declared and not used. Inside the quotes, language is just text, so the same line would be printed every time:

I think language is cool!
I think language is cool!
I think language is cool!

Assignment:

Your task is to fix our loop such that it will print the desired output.

STEP 1 OF 1
    Ctrl + Enter to check