5 Answered Questions for the topic loops


C++ Factorial Problem using Vectors

I am new to C++ and am struggling with a recent practice problem, I have some code so far but can't figure out how to get the variable to update to correctly give the next factorial. Here is the... more


In Ruby, how do I skip a loop in a .each loop, similar to 'continue'?

In Ruby, how do I skip a loop in a `.each` loop, similar to `continue` in other languages?


How to perform an action every 5 results?

How can I perform an action within a `for` loop every 5 results? Basically I'm just trying to emulate a table with 5 columns.
Loops Python List


Accessing the index in 'for' loops?

How do I access the index itself for a list like the following? ints = [8, 23, 45, 12, 78]When I loop through it using a `for` loop, how do I access the loop index, from 1 to 5 in this case?
Loops Ruby Arrays


What is the "right" way to iterate through an array in Ruby?

PHP, for all its warts, is pretty good on this count. There's no difference between an array and a hash (maybe I'm naive, but this seems obviously right to me), and to iterate through either you... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.