Topics in this sectionProgramming Languages2 topics
- Types of Programming Languages
- Similarities and Data Types
Programming Concepts and Data Types
When we write a program, we need to understand two important things: what all programming languages have in common, and how to work with different kinds of information. This note explains both of these ideas.
No matter which programming language you use—whether Python, C, Java, or JavaScript—you will find that every program does four basic things:
Input means getting data into your program. This could be typing your name on a keyboard, scanning a barcode, or receiving data from a sensor. In a simple program, input might be asking a user to enter their age or the price of sorghum at the market.
Output means showing or sending information out of your program. This could be displaying text on the screen, printing a receipt, or saving results to a file. For example, when a program displays "Welcome to Juba Market" on the screen, that is output.
Variables are like labelled containers that store information while your program runs. You give each variable a name so you can use it later. For instance, you might create a variable called price to store the cost of a bag of groundnuts, or temperature to store today's weather reading from Malakal.
Sequence means that statements in a program run in order, one after another. The computer reads your code from top to bottom, just like reading a story. If you want to change the order, you use special commands like loops or decisions.
These four ideas—input, output, variables, and sequence—are the building blocks of every program, no matter which language you choose.
When we store information in variables, the computer needs to know what kind of information it is. Is it a whole number, a word, or a yes/no answer? This classification is called a data type.
Different data types are suited for different kinds of information. Using the correct data type helps your program work correctly and efficiently.
A string is a data type used for text—sequences of characters such as words, sentences, or symbols. Strings can contain letters, numbers, spaces, and special characters, but the computer treats them all as plain text.
Strings are written inside quotation marks. This tells the computer to treat the characters as text, not as code or numbers.
Here is a simple example:
greeting = "Hello, student!"
market = "Juba Central Market"
Notice that even though "123" looks like a number, when written inside quotation marks it becomes a string. This is useful when you need to store phone numbers, identification numbers, or street addresses that start with digits but are not meant for mathematical calculations.
Numeric data types represent numbers that can be used in calculations. There are two main types:
Integers are whole numbers without any decimal part. You use integers when you need to count discrete items. Examples include: the number of students in a classroom (27), the quantity of bags of dura in a store (150), or a person's age (19).
Floating-point numbers (also called real numbers) have decimal points. You use these when you need precision, such as measuring temperature (32.5°C), the price of fuel per litre (SSP 4,250.50), or the weight of a sack of groundnuts (25.75 kg).
In many programming languages, you declare an integer like this:
student_count = 45
price_per_kg = 850.00
The computer knows that student_count is a whole number and price_per_kg can have decimals.
A Boolean data type can only hold one of two values: true or false. Booleans are used when you need to make decisions in your program.
For example, when a user logs into a system, the program checks if the password is correct. The result of this check is either true (the password matches) or false (it does not match).
Booleans are essential for controlling program flow. Your program can say: "If the user has paid, allow access; otherwise, show an error message."
A character is a single letter, digit, or symbol. Unlike a string, which can hold many characters, a character data type holds just one.
Characters are useful when you need to store individual items like a grade (A, B, C), a gender code (M or F), or a yes/no response (Y or N).
In many languages, characters are written inside single quotation marks:
grade = 'A'
initial = 'J'
An array is a data structure that holds a list of related values under one name. Each value in the array is accessed by its position, called an index. The first item is usually at index 0.
For example, imagine you are recording the daily temperatures for one week in Wau. You could store them all in one array:
temperature = [32, 33, 31, 34, 30, 29, 32]
To get the Wednesday temperature (the fourth day), you would use index 3:
wednesday_temp = temperature[3] # This gives 34
Arrays are very useful when you need to work with many related values, such as the prices of different crops, the names of students in a class, or the scores from a test.
A structure (or object in some languages) is a group of variables of different data types that are related and represented by a single name. Structures are useful when you want to describe something that has multiple properties.
For example, to describe a student, you might need their name (a string), their age (an integer), and whether they have paid school fees (a Boolean). You can group all this information into one structure:
struct Student {
name = "Mary"
age = 15
fees_paid = true
}
This makes your code organized and easier to read. Instead of managing separate variables for every piece of information about a student, you keep everything together.
Understanding data types helps you write programs that work correctly. If you try to add two strings together, you might get unexpected results. If you store a price as an integer when it has kujut (cents), you might lose important information. Choosing the right data type ensures your program handles information accurately.
In everyday life, data types are all around you. When a shopkeeper in a boma market records the price of sorghum per kilogram using an integer (like 850 SSP), records whether a customer has paid their debt using a Boolean (true or false), stores a customer's name as a string, or keeps a list of daily sales in an array—they are all using the same data type concepts that programming languages provide. Understanding data types helps you see how computers organize and process the information that makes modern markets, schools, and businesses work.
Question
Which four actions are common to all programming languages, no matter which one you use?
Sign in to submit your answer and have it count toward your mastery.
Sign in to practiceTutor
Stuck? Ask me anything about this topic.
Sign in to ask the Sonza AI Tutor about this question.
Sign in to askDiscussions
No questions yet