8000 Merge pull request #294 from codeOfRobin/patch-1 · codee/swift-algorithm-club@c783351 · GitHub
[go: up one dir, main page]

Skip to content

Commit c783351

Browse files
authored
Merge pull request kodecocodes#294 from codeOfRobin/patch-1
Made Peek() a computed property
2 parents 2dc72b8 + 16eb36c commit c783351

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Queue/Queue.playground/Contents.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public struct Queue<T> {
3434
}
3535
}
3636

37-
public func peek() -> T? {
37+
public var peek: T? {
3838
return array.first
3939
}
4040
}
@@ -56,7 +56,7 @@ queueOfNames.dequeue()
5656

5757
// Return the first element in the queue.
5858
// Returns "Lisa" since "Carl" was dequeued on the previous line.
59-
queueOfNames.peek()
59+
queueOfNames.peek
6060

6161
// Check to see if the queue is empty.
6262
// Returns "false" since the queue still has elements in it.

0 commit comments

Comments
 (0)
0