Chapter 6 - Variables and Constants

in #ios6 years ago
  • Variables are nothing but reserved memory locations to store values.
  • The value of a constant can’t be changed once it’s set, whereas a variable can be set to a different value in the future.
  • Declare constants with the let keyword and variables with the var keyword.
  • Constant and variable names can’t contain whitespace characters, keywords, mathematical symbols, arrows, Unicode code points.

Swift Tutorials Priya Talreja

You can provide a type annotation when you declare a constant or variable, to be clear about the kind of values the constant or variable can store. Write a type annotation by placing a colon after the constant or variable name, followed by a space, followed by the name of the type to use.

Swift Tutorials Priya Talreja

Github Link for Swift-Playgrounds

My next blog will be on Swift Optionals

Priya Talreja Xcode Tutorials
Please let me know if you have any doubts or queries in the comment section below.
Follow me @priyatalreja to get the latest feeds of iOS App step by step development tutorials.
Thanks.

Coin Marketplace

STEEM 0.36
TRX 0.12
JST 0.039
BTC 69735.97
ETH 3533.64
USDT 1.00
SBD 4.72