01.02.2014 Views

Objective-C Fundamentals

Objective-C Fundamentals

Objective-C Fundamentals

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Data types, variables,<br />

and constants<br />

This chapter covers<br />

■<br />

■<br />

■<br />

■<br />

■<br />

Storing numeric-, logic-, and text-based data<br />

Creating your own data types<br />

Converting values between different data types<br />

Formatting values for presentation<br />

Introducing the Rental Manager sample<br />

application<br />

Virtually every application needs to store, represent, or process data of some kind,<br />

whether a list of calendar appointments, the current weather conditions in New<br />

York, or the high scores of a game.<br />

Because <strong>Objective</strong>-C is a statically typed language, whenever you declare a variable,<br />

you must also specify the type of data you expect to store in it. As an example,<br />

the following variable declaration declares a variable named zombieCount, which is<br />

of type int:<br />

int zombieCount;<br />

Short for integer, int is a data type capable of storing a whole number between<br />

–2,147,483,648 and +2,147,483,647. In this chapter, you’ll discover many data<br />

28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!