Skip to content

FindLCM: Improve code readablility#985

Merged
raklaptudirm merged 3 commits intoTheAlgorithms:masterfrom
CarlosZoft:FindLcm
Apr 20, 2022
Merged

FindLCM: Improve code readablility#985
raklaptudirm merged 3 commits intoTheAlgorithms:masterfrom
CarlosZoft:FindLcm

Conversation

@CarlosZoft
Copy link
Copy Markdown
Member

Welcome to the JavaScript community

Open in Gitpod know more

Describe your change:

  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.

Copy link
Copy Markdown
Collaborator

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

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

I like the return; there already is a similar PR (https://github.com/TheAlgorithms/Javascript/pull/951/files) concerning the Math.max instead of the if-else. Again, please revert the change that relies on JS truthiness and use explicit comparison against zero (=== 0) as it is more readable and less error-prone in general.

(Technically the condition could even be shortened further as !((lcm % num1) || (lcm % num2)) according to De Morgan's law, but that sure would be unreadable ;) )

@appgurueu appgurueu added feature Adds a new feature changes required This pull request needs changes beginner-friendly Easy to implement labels Apr 20, 2022
@CarlosZoft
Copy link
Copy Markdown
Member Author

true, i will fix this

@CarlosZoft
Copy link
Copy Markdown
Member Author

Fixed it. But what you think, i remove math.max approached in another PR or not?

Copy link
Copy Markdown
Collaborator

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

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

Looks fine now. LGTM.

@raklaptudirm raklaptudirm changed the title fix: improving code readability FindLCM: Improve code readablility Apr 20, 2022
@raklaptudirm raklaptudirm merged commit 8fc5390 into TheAlgorithms:master Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginner-friendly Easy to implement changes required This pull request needs changes feature Adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants