This repository was archived by the owner on Mar 25, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's possible to improve even more, what do you think about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pierre I think the way it as originally was better for initial understanding. Then as you rightly pointed out the condensed refactored version is how you would solve on the job. The original in my opinion helps with basic beginner understanding ie. It highlights getItemCount is a function with return type Int and the return FROM that function is the list size. With out knowing this, its possible to interpret the condensed version as a variable assignment. Then what getItemCount does with it? and why not as a parameter to the variable etc. So a whole rabbit hole of questions which pop up during the learning journey.