Skip to content

Commit e0c8738

Browse files
committed
[Swift 4.2] Updated Linked List
1 parent a31bd41 commit e0c8738

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Linked List/LinkedList.playground/Contents.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
// For best results, don't forget to select "Show Rendered Markup" from XCode's "Editor" menu
44

55
//: Linked List Class Declaration:
6-
// last checked with Xcode 9.0b4
7-
#if swift(>=4.0)
8-
print("Hello, Swift 4!")
9-
#endif
106

117
public final class LinkedList<T> {
128

@@ -459,7 +455,7 @@ var sum = 0
459455
for element in collection {
460456
sum += element
461457
}
462-
// sum is 15
458+
sum //15
463459

464460
// Another way of achieving the same result though 'reduce', another method defined in an extension of Sequence. Collections are Sequences.
465461
let result = collection.reduce(0) {$0 + $1} // 15

0 commit comments

Comments
 (0)