Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for loop structure to improve readability #353

Closed
wants to merge 1 commit into from

Conversation

0xwitty
Copy link

@0xwitty 0xwitty commented Nov 26, 2024

Description

This update refactors the loop to use a more concise arrow function, which improves the clarity of the code. Previously, the numberOfLeaves variable was defined with a broader scope, but by using a const inside the loop, its scope is now limited to the loop's iteration. This small change not only enhances code readability but also helps prevent potential issues related to variable scope, making the code easier to maintain in the future.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run yarn style without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Collaborator

@0xDatapunk 0xDatapunk left a comment

Choose a reason for hiding this comment

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

nice

Copy link
Member

@cedoor cedoor left a comment

Choose a reason for hiding this comment

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

Hi @0xwitty! What's the point of keeping let numberOfLeaves: number? Can we remove it?

Copy link
Member

@sripwoud sripwoud left a comment

Choose a reason for hiding this comment

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

If we start refactoring...
I think the logic is simple enough to avoid declaring numberOfLeaves altogether

@sripwoud sripwoud closed this Dec 10, 2024
@0xwitty 0xwitty deleted the patch-1 branch December 14, 2024 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants