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

  • 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
主站蜘蛛池模板: 巴塘县| 赤峰市| 黑河市| 景谷| 灵丘县| 新龙县| 西和县| 东港市| 乌拉特后旗| 阜新市| 南康市| 滨州市| 安仁县| 五大连池市| 宿迁市| 射阳县| 安宁市| 英山县| 彰武县| 鲁甸县| 邹城市| 东兴市| 南康市| 伊金霍洛旗| 泸州市| 肇州县| 望城县| 楚雄市| 贡嘎县| 竹北市| 西宁市| 西青区| 台东县| 平罗县| 托里县| 富源县| 修武县| 浦东新区| 巴彦淖尔市| 延津县| 永福县|