Skip to content

Stack pop function is unnecessarily complex #144

@timvermeulen

Description

@timvermeulen

Instead of

public mutating func pop() -> T? {
  if isEmpty {
    return nil
  } else {
    return array.removeLast()
  }
}

we can just do

public mutating func pop() -> T? {
  return array.popLast()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions