Data Types

Edit this Page

Data Types tell us how some data is being represented and how we can interact with it. Knowing some data's type opens up a developers options for working with it significantly.

The following example demonstrates how the same code with different types of data results in different behavior:

Here, 1 represents a number (or integer), while "one" represents a word (or string)

When we tell a computer to add 5 and 10 together we would get an answer of 15.

(in Ruby)

puts 5 + 10

(in JavaScript)

console.log(5 + 10);

When we tell a computer to add "5" and "10" together, we get an answer of "510".

(in Ruby)

puts "5" + "10"

(in JavaScript)

console.log("5" + "10");

Data types may be either basic or composite-data-types. Data types your programming language provides by default are called "built in" data types.