Types

The variables you define in your prototype will be able to contain different kinds of information. In CoffeeScript, we find different types of data with which we can work. These are common to many programming languages. In this chapter, we will also need to talk about numbers, strings, booleans, arrays, and objects:

  • Numbers capture numerical values, such as 2, 100, and -250.
  • Strings define textual information, and they are expressed in quotation marks, such as "welcome to your app".
  • Booleans are logical binary values; they will take the value of TRUE or FALSE. They are useful for describing logic conditions to guide decisions in the behavior of your prototype.
  • Arrays are collections of values, such as [3,5,2,9] or ["London", "Paris", and "Milan"].
  • Objects represent more complex structured information. They have properties of any data type and set of functions describing their associated functionality that we will call methods. Elements such as the layers of your prototype will be represented by objects where you can access properties, such as their height, and methods, such as one to center the layer in the screen. We will cover the functions later.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.108.168