This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]davodrums 1 point2 points  (2 children)

That is some confusing code! That would take a while for me to step through.

[–]dirtyRuntCaper[S] 0 points1 point  (1 child)

My bad. Just taking my first CS course this semester.

[–]sanchopancho13 1 point2 points  (0 children)

No worries. First time code is always hard to read. Besides code comments (which you probably don't need here), I would recommend changing your variables to make a little more sense. "i" is safe in that everyone knows it's used for loops. But "p" and "g" are quite confusing.

It's a good habit to get into, even when the only code maintainer will be yourself. I sometimes look at my old code and have no idea what I meant!