Chapter 6 - Variables and Constants

in ios •  6 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.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Excellent post!

Thank yu :-)