Chapter 2. Data types, variables, and constants


This chapter covers
  • Storing numeric-, logic-, and text-based data
  • Creating your own data types
  • Converting values between different data types
  • Formatting values for presentation
  • Introducing the Rental Manager sample application


Virtually every application needs to store, represent, or process data of some kind, whether a list of calendar appointments, the current weather conditions in New York, or the high scores of a game.

Because Objective-C is a statically typed language, whenever you declare a variable, you must also specify the type of data you expect to store in it. As an example, the following variable declaration declares a variable named zombieCount, which is of type int:

int ...

Get Objective-C Fundamentals now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.