[swift-evolution] Hidden initiallizations ...

Biala bialata at yahoo.com
Mon Mar 28 09:29:52 CDT 2016


Look at that code:
var i:Int = 0
for i in (0..100){        ///...        if (i == 50)
        {
               break        } 
}

print("i=\(i)")

What is the value of i ?? Please remove this nonsense from the language unless you are happy to see it job interview questions in future :) My suggestion is to use the variable i in the loop instead of making hidden init of another "i" for the loop. 

Everything that is hidden = evil. It is not saving time but creating bugs. Code should be clear and understandable from first view...
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160328/6d46bbbc/attachment.html>


More information about the swift-evolution mailing list