r/AskProgramming • u/Cold_Abrocoma7320 • 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
View all comments
Show parent comment
2
u/JaguarMammoth6231 Oct 11 '26 edited Oct 11 '26
Good point. A lot of people start off thinking that if you're going to do something similar multiple times you should use a loop, but it's really best when you're doing exactly the same thing.
You don't want to follow the for-if or for-case anti-pattern of