in reply to Re: why is my for loop using modulo giving me a weird output
in thread why is my for loop using modulo giving me a weird output
first, I tried with five just to check out how modulo worked
nothing to do with even number yet. this is a incremental test code for me to learn perl code
I expected the output to look like this:
1 2 3 4
this is because as I go thru the for loop, I goes thru 1,2,3,4,5,6,7,8,9,10,...,15,...20
but the for loop returns "0" 1 2 3 4( not as expected with "0") then it gives me the same output another 4 times. I don't understand the output being given 4 times.
sorry for not being clearer
perhaps this helps explain my question on iteration
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: why is my for loop using modulo giving me a weird output
by afoken (Chancellor) on Jun 28, 2015 at 07:24 UTC | |
by perlynewby (Scribe) on Jun 28, 2015 at 08:10 UTC | |
by marinersk (Priest) on Jun 28, 2015 at 08:50 UTC | |
by perlynewby (Scribe) on Jun 28, 2015 at 09:51 UTC | |
by ww (Archbishop) on Jun 28, 2015 at 11:35 UTC | |
by marinersk (Priest) on Jun 29, 2015 at 14:29 UTC | |
|
Re^3: why is my for loop using modulo giving me a weird output
by 2teez (Vicar) on Jun 28, 2015 at 07:16 UTC | |
by perlynewby (Scribe) on Jun 28, 2015 at 08:22 UTC |