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

implement #last and #empty? #39

Merged
merged 1 commit into from
May 11, 2019
Merged

Conversation

moba1
Copy link
Collaborator

@moba1 moba1 commented May 10, 2019

Abstract

add #last and #empty? method to List

  • #last: return last element of List
  • #empty?: return true for empty list, false for others

Example

#last

List[1,2,3].last == 3
List.new([] of Int32).last # throw IndexError

#empty?

List[1].empty? == false
List.new([] of Int32).empty? == true

@moba1 moba1 requested a review from alex-lairan May 10, 2019 13:47
@alex-lairan alex-lairan merged commit 8a47d39 into master May 11, 2019
@moba1 moba1 deleted the add/impl-#last-and-#empty branch May 11, 2019 12:55
@alex-lairan alex-lairan mentioned this pull request May 21, 2019
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.

2 participants