官术网_书友最值得收藏!

Why constants versus variables?

You might be asking yourself "Why would you ever want to make something constant?". Since constants cannot change after you run your app, they keep you from accidentally breaking a value that should not change. Another excellent use for constants is for base URLs, as you would not want these to change. When you are getting data, you do not want to change the value midway through your app accidentally. Apple recommends that you use let whenever possible. Typically, I use let until Xcode warns me that a var is preferable. If I change the value from let to var, then I am verifying that this is the behavior I want.

主站蜘蛛池模板: 吉安县| 诸暨市| 五寨县| 都江堰市| 千阳县| 绿春县| 华安县| 永丰县| 恩平市| 榆树市| 陕西省| 双柏县| 海丰县| 郯城县| 托克逊县| 丹寨县| 林甸县| 蕉岭县| 石河子市| 衡东县| 灵武市| 剑阁县| 中西区| 普格县| 昌江| 辽源市| 土默特左旗| 万安县| 灵丘县| 宁武县| 墨脱县| 横山县| 红原县| 亚东县| 金湖县| 开原市| 宁晋县| 工布江达县| 浦北县| 临颍县| 鄂尔多斯市|