Learn programming logic in 5 minutes

Programming logic is the way you write a computer program, an animal. An animal is a sequence of steps to perform a function. An example of an algorithm for processing is a cake recipe. In the recipe, you must follow the steps for the cake to be ready and without any problem. In computing, programmers write as “cake recipes” (algorithms) so that the computer reads and understands what must be done when executing the algorithm. For this you need a programming language. A programming language is like a normal language, a group of words with meanings. In the case of programming, most languages ​​are written in English. In these languages ​​the computer assimilates each command and function of a configurator, then executes each function.

The programming language is just how the algorithm is written. The big problem for many is what to “tell” the computer to do what is desired. For learning, VisualG Software was developed, which helps programming entirely in Portuguese. With this software, it is not necessary to think about a programming language, because all the commands are in Portuguese, leaving the focus on Logic. When programming, some steps are essential, such as Declaring Variables. Variables can be written as letters or numbers, which represent a value that can be changed at any time. Each variable has a memory space to store its data. However, there are several types of data, the most common being: Numeric: any and all number types, positive or negative Reals: can be positive or negative and decimal. Character: These are the texts. Any number can enter here, but it will not have a mathematical function.

Knowing programming logic is knowing the best way to write code, for the computer to interpret correctly. It's knowing how to communicate with the machine from any language. An example of an algorithm, which aims to add 3 integers. "Sum" Algorithm Var Num1, num2, num3, result:integer Start print("This program will add 3 integers of your choice:") print("Enter an integer:") read(num1) print("Enter a number to add to the first number:") Read (num2) print("Enter a third number to add to the other 2 numbers:") Read (num3) Result <- num1+num2+num3 print("The result is: ") write (result) fimalgorithm in the algorithm above, some elements are the specific commands of the "Portugol" language: Var, Start, Write, read, <-, Fimalgoritmo, :Integer. These commands have specific functions, and one of the goals of programming logic is to understand how they work. Each language has one corresponding to these commands, with the same function, but written differently (syntax).

Comments

You must be logged in to post a comment.