Using Logic To Code

Updated: January 25, 2022
No Credit Card Required
ClaimYour
FreeTrialClass

Transcript

Some people are more logical than others. They take a very logical approach to everything they do, and they are capable of making perfectly reasoned decisions. Logic is a tool used for reasoning, interpreting events and taking actions, especially when we want to know the answer to something or to complete a certain task. It is used in decision making, and it helps us structure the order of tasks. If the lead in your pencil becomes blunt, then the logical thing to do is to sharpen the pencil. And if you make a mistake while writing, the logical step is to get an eraser and fix it. So logic is very important, right?

And when it comes to computer programming, logic is the way in which we convert information into a format that a computer understands. This is called logic programming. Now, logic programming isn't the full program, but rather a guide or template of the way a program will be written. It is written before the coding is done, and it acts as a guide for the programmer to make the coding process easier and more clear.

There are three steps in creating a computer program. First, you write the flowchart of the program. This helps programmers and non programmers better understand the process of the program. Then you write the logic programming, which outlines how the computer should interpret each variable. Finally, you write the full program in your chosen programming language.

The logic program sits somewhere in the middle of the program creation process. It's more detailed than the flowchart, but not complete enough to be a fully running program. Symbols like arrows and operators are usually used in it. The main focus is to make sure the flow of the idea is written in a clear way.

A very simple logic program would for example, instruct as long as you have paper, write. When you reach a condition where you no longer have paper, it will then display give me more paper. Very logical indeed. Once there is no space left on the paper, you should do the next logical thing. Pull out another sheet of paper and continue writing. You can continue to repeat these three simple logic programs until the goal of finishing the assignment is complete.

So as it turns out, people and computers both have logic programs. logic programming is a necessary tool for giving programmers an idea of what the program will look like without being too technical. It gives a basic blueprint of the program and logic can also help you get an assignment completed on time. Which of course if you want an A in class is the logical thing to do.

Loading...