* enumerate() vs enumerated()

In tutorials for Swift on Linux, the following code is given:

var arr = ["one", "two", "three"]
  for (i,v) in arr.enumerated() {
  print("\(i) \(v)")
}

Doing a search on Apple’s Swift documentation also returns enumerated() as the method name

https://developer.apple.com/documentation/swift/array/1687832-enumerated

=================================

However, in Silver, the code that works is:

var arr = ["one", "two", "three"]
  for (i,v) in arr.enumerate() {
  print("\(i) \(v)")
}

as per the Swift Base Library documentation:

https://docs.elementscompiler.com/API/SwiftBaseLibrary/Extensions/System.Collections.Generic.IEnumerable-T-/

Is there a good reason for the difference in naming/spelling?

probably that the swift community, in their infinite wisdom, rename stuff every five minutes. i’ll adjust ours to match, thanx for letting us know…

Fixed, on GitHub and for today’s upcoming build.

1 Like