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

  • Mastering Swift
  • Jon Hoffman
  • 196字
  • 2021-07-16 14:12:11

Chapter 2. Learning about Variables, Constants, Strings, and Operators

The first program I ever wrote was written in the basic programming language, and was the typical Hello World application. This application was pretty exciting at first, but the excitement of printing static text wore off pretty quickly. For my second application, I used basic's input command to prompt the user for a name and then printed out a custom hello message to the user with their name in it. At the age of 12, it was pretty cool to display Hello Han Solo. This application led me to create numerous Mad Lib style applications that prompted the user for various words and then put those words into a story that was displayed after the user entered all the required words. These applications introduced me to, and taught me, the importance of variables. Every useful application I created since then has used variables.

In this chapter, we will cover the following topics:

  • What are variables and constants?
  • Difference between explicit and inferred typing
  • Explaining numeric, string, and Boolean types
  • Defining what optional types are
  • Explaining how enumerations work in Swift
  • Explaining how Swift's operators work
主站蜘蛛池模板: 潜山县| 南雄市| 诏安县| 梧州市| 兴仁县| 衡南县| 资兴市| 腾冲县| 大埔区| 宁波市| 鸡东县| 二连浩特市| 即墨市| 长沙县| 霞浦县| 通州市| 塘沽区| 武功县| 新密市| 九江市| 龙口市| 山阳县| 宁明县| 四平市| 黔西| 自治县| 抚州市| 南开区| 沈丘县| 博野县| 县级市| 松江区| 桓仁| 山东省| 大连市| 乐清市| 海兴县| 锦屏县| 丹寨县| 乳源| 西乌|