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

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.

主站蜘蛛池模板: 周口市| 龙陵县| 汤原县| 泾川县| 丘北县| 洛阳市| 关岭| 杨浦区| 榕江县| 建始县| 平乡县| 彭州市| 肇源县| 习水县| 新宾| 安阳市| 岳池县| 武隆县| 葵青区| 犍为县| 小金县| 团风县| 文安县| 集安市| 松原市| 海盐县| 基隆市| 封开县| 徐水县| 苍梧县| 邻水| 大方县| 崇礼县| 濉溪县| 巴彦淖尔市| 新兴县| 枝江市| 洮南市| 古交市| 噶尔县| 策勒县|