FAQ: Loops - Putting it All Together

#1

This community-built FAQ covers the “Putting it All Together” exercise from the lesson “Loops”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn How to Code

FAQs on the exercise Putting it All Together

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

#3

ok…i’m on the Putting It All Together part of the Loops lesson and i’m looking at the examples for For Loops and While Loops and all i can think is “where the ■■■■ did those i’s and semi-colons come from?” Did i miss something? Maybe I’m having trouble putting two and two together, but the (i = 0; i < 10; i++) confused me and for the first time in this whole course, I’m completely lost…

10 Likes
#4

Same. My gut interpreted it as the conditions that would read kinda of like this (but i’m not sure it’s correct):

FOR loop
for (i = 0; i < 10; i++) { //for index starting at 0; with up to 10 items indexed; repeat the index
placeTile(‘mint’)
placeTile(‘orange’)
placeTile(‘mint’)

WHILE loop
let i = 0; //let index start at 0
while (i < 10) { //run list until index reaches 10
placeTile(‘mint’)
placeTile(‘orange’)
placeTile(‘mint’)
i++ //repeat indexed tiles as above (just like the === means verify it’s really true, i’m guessing ++ means add up the items

It’d be great if someone could confirm or correct this :slight_smile:

3 Likes
#5

A little modification on the previous response:

let i = 0
while (i < 10)
{
placeTile(‘mint’)
placeTile(‘orange’)
placeTile(‘mint’)
i++
}

//Corrected.

#6

Looks like that confirmation has not been forthcoming.

i++

is the JS shorthand to increment i.

i++  <=  i += 1  <=  i = i + 1
#7

Having trouble getting past the Review, it’s not loading the next page (assuming it’s a quiz)

When I click the “Up Next” button I get a white screen.