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 zombieCount;

Short for integer, int is a data type capable of storing a whole number between −2,147,483,648 and +2,147,483,647. In this chapter, you’ll discover many data types that can be used to store a wide range of real-world values. But before we dive in too far, let’s introduce the Rental Manager application that we build over the course of this book.

2.1. Introducing the Rental Manager application

 

2.2. The basic data types

 
 
 

2.3. Displaying and converting values

 
 
 

2.4. Creating your own data types

 

2.5. Completing Rental Manager v1.0, App Store here we come!

 
 
 

2.6. Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest