Using Inputs in Your Code

Updated: January 25, 2022
No Credit Card Required


In the army disciplines important, everyone has to obey orders. Otherwise, chaos would ensue. Soldiers are only humans though, and mistakes are going to be made. But the army takes mistakes seriously, and hand out severe punishments.

Computers and robots will always obey orders, but orders have to be given in code so they are understood by the computer. Once code is written, it cannot be changed, and a computer can't predict what instructions it will be given in the future, and so yelling is pointless. There is another option to get additional orders to computers, though, when writing code, programmers create opportunities for users to enter instructions themselves.

Every order given to a computer is considered an input, and the computer follows its instructions. Inputs are any kind of value that influence a conditional statement within the code to start a specific scenario. To give computers orders, we use devices like a mouse or a keyboard. Nowadays, audio and visual inputs are being used as well, like voice orders, or visual recognition, an input can trigger different actions.

Scanning a barcode for example, lets the computer know where to put a box and a key word. Let's search for all boxes containing the same item. While these are direct orders, visual sensor inputs tell the robot what is happening around it. Of course, a robot can only work with numerical input. each click of the mouse or letter you press on your keyboard is being translated to digits, even the audio or visual input coming from sensors are being translated. That's the only language robots and computers understand.

The instructions for robots and computers can be divided into two parts. There is the code written by a programmer, the general instruction, and there are the inputs the robot receives while it is following the general instructions.

While working with inputs a computer stores information as variables. You can think of variables as containers that hold information, their sole purpose is to label and store data in the computer's memory. When this data isn't of use anymore, it is deleted to make room for other information.

User input is one of the most important computer concepts. If an action from a user is expected, it's an input. If any data from outside the robot is needed. This is always an input. Without inputs. Computers would not be as widely used or as useful as they are today because they need orders to do their job. Unlike humans, though, computers Don't moan and groan about taking orders. If they don't understand the input, their program shows an error message or they go into idle mode.