Eposode 146: Variables and data types

Comic Transcript

Panel 1.
Laby: Ludd, stop asking Kodu questions, you will only encourage her!
Ludd: But programming is cool and I wanna learn more.

Panel 2.
Kodu: There! Besides, Laby, you can’t stop me from talking to my new BFF.

Panel 3.
Kodu: Where was I? Oh yeah. In the beginning of a program is where you would put the variables and initial values. You use these later to receive input and produce output.

Panel 4.
Alkina: Don’t forget data types.
Ludd: What are those?

Panel 5.
Kodu: Geez, I was just gonna get to that. Data types tell the program what type of data to expect, for example, whether they are numbers or words. This makes it possible for the program to know how to deal with the variables.
Ludd: Like whether numerical operations will be performed on them, or not?
Kodu: Exactly!

What does it mean?

Variable (computer science) – In computer science, a variable is a placeholder for a value that can change. For example, if you are programming how a phone works, you want to make sure that it will be able to dial different phone numbers and be able to retrieve numbers from recent calls. These values (phone numbers) can be stored in variables until they are needed.

Initial (default) value – The starting value for a variable. Without a starting value, a computer program may be behave in unexpected ways when it comes time to use a variable that has no default value.

Input – The values that are fed into a computer program from a user or perhaps a sensor, for example, a temperature sensor.

Output – The result of a computer program that is displayed to a user, or transmitted to another computer program or a device, which in turn does something with the result.

Data type – lets the computer know what type of data to expect, whether they are numbers, or sets of numbers or if they are words.

Numerical operations – Mathematical operations like adding, subtracting, multiplying or dividing numbers.

Is that all?

Variables and data types – This webpage describes computer variables and data types with more details.