r/AskProgramming • • Oct 11 '26

For loop

How would I store 3 different answers to the same 3 questions asked using a for loop. I know how to store one answer, but not all three while still using the for loop

0 Upvotes

13 comments sorted by

View all comments

4

u/naomimyselfandi Oct 11 '26

I'd need some more context for what you're doing to really answer this. Is your setup something like this?

int questionCount = 3;
for (int questionId = 0; questionId < questionCount; questionId++) {
  // do stuff
}

Or if you're using Python:

questionCount = 3
for questionId in range(0, questionCount):
  # do stuff