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

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.

主站蜘蛛池模板: 安福县| 阿勒泰市| 榆林市| 楚雄市| 方城县| 涞源县| 彭州市| 安多县| 阿鲁科尔沁旗| 和田县| 中阳县| 邵东县| 水城县| 留坝县| 油尖旺区| 漯河市| 蓬溪县| 那曲县| 舟曲县| 馆陶县| 库车县| 靖州| 晋中市| 永济市| 塘沽区| 东宁县| 鹤岗市| 吴桥县| 岳普湖县| 陇川县| 达州市| 闵行区| 宝鸡市| 洛阳市| 博客| 中山市| 武乡县| 盐边县| 七台河市| 绥德县| 榆中县|