#for loop help
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
well, you can see that when you they call the method, they pass it a 9 as the n argument
and then it is used in the for loop
that will iterate from 3 up to 9
that is 6 times, so it will do whatever is inside of the brackets by 6 times
mhm
Since it is p <= 9 should it be 7 times?
i get 64
3,4,5,6,7,8,9
starts at tho
you're right
after first loop 4
@floral raft or @keen lake can some1 run me through step by step
Ok - what is k1 to k3 after the first loop?
Incorrect
how
well the first time it iterates, you have k1 = 1, k2 = 1, and k3 = 2
the next time, it goes k1 = 1 because k2 was 1 on the previous iteration, k2 = 2 because k3 was 2, and k3 = 1 + 2, so it is 3, and then again and again
you have 2 iterations there
You have to think in steps and what is true NOW versus in the past or future. Slow and steady.
yeah, think about it like there is no for loop, and it's just the same chunk of code repeated 7 times
you can see how the variables are constantly rewriting their past versions
(It also works out to be a very famous sequence)