We all would have written a piece of code similar to this, The usual way,
As a Swift developer we always want to write better code. In Swift, we can use the “where” clause along with the for loop. The Swift way,
Neat isn’t it? Playground sample,
Edit — Thanks to Md. Ibrahim Hassan for giving a better sample code. Follow me on Twitter. Have any queries? Feel free to DM me.
Like our articles? Support us!