Get job ready skills with Codenga     |       Career Paths up to 50% OFF     |        Limited time only

3d 05h
close
Cart icon
User menu icon
User icon
Lightbulb icon
How it works?
FAQ icon
FAQ
Contact icon
Contact
Terms of service icon
Terms of service
Privacy policy icon
Privacy Policy
Zdjęcie główne artykułu.

The most important symbols used in programming

Programming is largely about writing instructions for the computer. In order to make these instructions understandable, we need to use the proper symbols. Using these symbols, we build the logical structure of our code.

It's a bit like the natural language we use every day. It has symbols such as dots, commas, etc. This allows us to create logical and understandable statements. In programming, it works in a very similar way. So a symbol in programming is just like a symbol in our written language.

Let's now look at the most popular symbols we use in coding/programming.

Become a programmer: interactive and affordable courses that will teach you how to code

Semicolons ;

The semicolon is a symbol that indicates the end of an instruction. In programming, it plays a similar role as a period at the end of a sentence. Look at the example:


  return a + b;


With the semicolon, we declare where the return instruction should end. Everything that is after the semicolon will be part of separate instructions. Semicolons are used in languages such as Java, C++, C# or PHP. There are also languages, like Python, that don't use any symbols at the end of the instruction.

Curly braces {}

Braces are used to define blocks of code. In practice, such a block can be a function, class, or similar structure. With their help, we specify that a certain set of instructions belongs to a single block. Here is an example:


  function add(a, b) {
   return a + b;
  }


We got a function named add. The block of this function has been delimited with the curly braces: { and }. This means that all instructions placed inside, should be treated as a single, distinct block.

Another example:


  if (a > b) {
    console.log(a + " is greater than " + b);
  } else {
    console.log(b + " is greater than " + a);
  }


This time we got two blocks: if and else. Each of these blocks contains certain instructions.

Parentheses ()

Ordinary parentheses are often used to define the list of function arguments (also called parameters). Let's return to this example:


  function add(a, b) {
   return a + b; 
  }


Note that the function takes two arguments: a and b. These arguments are defined in ordinary parentheses.

Square Brackets []

Square brackets denote a set of values. Such a set is sometimes called an array or list. Example:


  let fruits = ['banana', 'apple', 'orange', 'mango'];


In the above example, we created an array named fruits. It contains 4 values, declared in square brackets. We can also use square brackets to refer to a specific value from the set:


  fruits[0]


In this code fragment, we used square brackets to refer to the element at the so-called index 0. This is often the first element in the array.

The "=" sign

The "=" sign is a symbol used to assign a value to a variable. Variables in programming are containers for storing data. If you want to assign data to a variable, you can use this syntax:


  result = 123


This syntax should be interpreted as follows: assign the value 123 to the variable result. That's why we sometimes say that the "=" symbol is the assignment operator.

The "==" sign

The symbol known as the "double equal sign" is used to compare values. Take a look at the example:


  4 == 5


In the above code snippet, we used this symbol to check if 4 is equal to 5. It's important to distinguish between a single equal sign (assignment operator) and a double equal sign (comparison operator).

Additional symbols are often used such as:

> which means ‘greater than’
< which means ‘less than’
!= which means ‘not equal’ (inequality)
>= which means ‘greater than or equal to’
<= which means ‘less than or equal to’

Note the exclamation point (!). In programming, it is often used to negate a value.

Double quotes "" and single quotes ''

Double quotes and single quotes are symbols used to define a text string (sometimes referred to as a string). With their help, we determine the beginning and end of a text string. Examples:


  let name = 'developer';
  let role = "Admin";


We have two strings assigned to variables. Interestingly, in many programming languages you can use either double quotes or single quotes interchangeably. It's just a matter of personal preference. However, it is important not to mix two different symbols in this way:


  let name = 'developer";

The above code is invalid. You cannot define a single string using a mix of double quotes and single quotes.

Mathematical symbols

There are some mathematical symbols that we commonly use to perform arithmetical operations:

  • + (plus) is used to perform addition
  • - (minus) is used to perform subtraction
  • / (slash) is used to perform division
  • * (asterisk) is used to perform multiplication
  • % is known as a modulo operator and it gives us a remainder of the division
  • ^ (caret) is used to perform exponentation in some languages

Logical operators (symbols)

We also have some coding symbols that allow us to create complex conditional statements:

  • && - operator known as AND (both statements need to be true)
  • || - operator known as OR (al least one statement need to be true)

Summary

Programming (or coding as some say) symbols serve as the language through which we communicate instructions to computers, constructing the logical framework of our code. From semicolons indicating the end of instructions to braces delineating code blocks, and from parentheses specifying function arguments to mathematical symbols facilitating arithmetic operations, each symbol plays a crucial role in shaping the functionality and clarity of our programs.

Become a programmer: interactive and affordable courses that will teach you how to code