Explicit and Implicit Variables

 What is a Variable?

Using implicit or explicit variables is an important decision when choosing what language to use when writing a program or starting to code. In simplest terms, a variable is used to remember a value for later use. The way different programming languages use variables is important for programmers to keep in mind when choosing how to code variables. Implicit variables are when the compiler chooses the type of output and explicit variables are when the programmer pre-assigns variables to have a specific output.

Examples of Variables

Each can be useful depending on the program that is being written. Boudreau points out that implicit variables can often be easier to use in programming and that sometimes the results can be just fine. However, leaving the compiler making that decision making on an assumption can often lead to problems. Explicit assigning of variables gives a more specific output and result and can be much more reliable. Depending on the language, the programmer may want to only code using explicit variables.

Examples of an implicit variable would be adding two numbers and assigning variables to num1=10 and num2=20.66. If we let Python assign the variable types, in this equation Python would assign num1 as an integer and num2 as a float. In explicit variables, the programmer is specifically telling the compiler what type of data the code should be. An example would be the int() feature that the class is currently using to assign a string to hold the integer value.

Application in the Real World

In terms of real-world application, I could see where business would want to use specific code and probably would lean to a more explicit type of variable casting. When working with scientific data, money, business and finance most outputs will need to be exact. Most business leaders would want repeatable results from a program and would not want to output to vary each time the program was being used.

Comments

Popular posts from this blog

Employee Management System - Simple Project

Creating Tables in MySQL