Variables and Data Types

Data Types

In programming, there are a few basic data types you'll be dealing with. These include:

Sometimes you'll type these out directly, such as when comparing, but normally these are bound to variables.

Variables

Variables can be seen as a name which contains a value. In higher level languages like Python, Lua, or JavaScript, you don't actually have to specify the type of the variable, and can just type them out like this:

Python:

(they can be named whatever you want them to be, with a few exceptions)

Lua:

JavaScript

 

However, in more advanced lower level languages, you have to start specifying what type a variable should be, and that can't change.

For example:

C:

C++:

Java:

Rust:

 

Arrays

Arrays (sometimes called "lists" or "tables") are a collection of variables. In scripting languages like Python, Lua, and JS, they usually can contain multiple types, but in lower level languages like Java, C, or Rust, they have to be typed AND have a fixed length (however there are other classes to get around this).