Skip to content

Conversation

ColstonBod-oy
Copy link
Contributor

Modified the way the variables are used and named as I find them a bit confusing at first glance.

Modified the way the variables are used and named as I find them a bit confusing at first glance.
Copy link
Collaborator

@mitchellirvin mitchellirvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @ColstonBod-oy ! thank you for the contribution!

i'm not sure about the name diffNum. it implies "difference number", but that's not actually what it is (it's not the result of subtraction operation). it is the "current number in a loop over a collection of numbers". also, diffNum now clashes with diff, and it's not clear looking at them side by side what the difference is.

it's pretty standard to use the convention: int type = types[i]; when capturing the current element in a loop, so i think the existing code of int num = nums[i]; makes sense. you usually only see a more specific name, maybe currentNum or the like when there is a "next" or "previous" to track as well.

i think the change on line 13 is a positive one, but in general I don't think the other changes improve the readability.

@ColstonBod-oy
Copy link
Contributor Author

Changed the code on line 13 to use the variable diff instead.

@github-actions
Copy link

Stale pull request message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants