Skip to main content
Code Review

Return to Question

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Since the deprecation of C-style for loops in Swift 2.2 (and the removal in Swift 3), several questions about the possible replacements were asked on Stack Overflow were asked on Stack Overflow. In most cases, a for .. in loop is the appropriate replacement:

And finally an example where you iterate over a linked list of network interfaces (compare How to get Ip address in swift How to get Ip address in swift):

Since the deprecation of C-style for loops in Swift 2.2 (and the removal in Swift 3), several questions about the possible replacements were asked on Stack Overflow. In most cases, a for .. in loop is the appropriate replacement:

And finally an example where you iterate over a linked list of network interfaces (compare How to get Ip address in swift):

Since the deprecation of C-style for loops in Swift 2.2 (and the removal in Swift 3), several questions about the possible replacements were asked on Stack Overflow. In most cases, a for .. in loop is the appropriate replacement:

And finally an example where you iterate over a linked list of network interfaces (compare How to get Ip address in swift):

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

However, this has some disadvantages (and I cannot formulate it better than @nhgrif did in Swift replacement for C's for-loop Swift replacement for C's for-loop):

  • The stride (advance) is not constant.
  • The terminating condition is "dynamic" (depends on the loop variable), as in Swift replacement for C's for-loop.
  • The loop variable is not a strideable type (e.g. a linked list).

However, this has some disadvantages (and I cannot formulate it better than @nhgrif did in Swift replacement for C's for-loop):

  • The stride (advance) is not constant.
  • The terminating condition is "dynamic" (depends on the loop variable), as in Swift replacement for C's for-loop.
  • The loop variable is not a strideable type (e.g. a linked list).

However, this has some disadvantages (and I cannot formulate it better than @nhgrif did in Swift replacement for C's for-loop):

Tweeted twitter.com/StackCodeReview/status/716770070966439937
deleted 6 characters in body
Source Link
Martin R
  • 24.2k
  • 2
  • 37
  • 95

However, this has some disadvantages (and I cannot formulate it better than @nhgrif did in Swift replacement for C's for-loop again):

However, this has some disadvantages (and I cannot formulate it better than @nhgrif did in Swift replacement for C's for-loop again):

However, this has some disadvantages (and I cannot formulate it better than @nhgrif did in Swift replacement for C's for-loop):

added 4 characters in body
Source Link
Martin R
  • 24.2k
  • 2
  • 37
  • 95
Loading
Source Link
Martin R
  • 24.2k
  • 2
  • 37
  • 95
Loading
default

AltStyle によって変換されたページ (->オリジナル) /