In many programming language is necessary to declare which kind of variable will be used. The examples are:

  • INT = round numbers;
  • DOUBLE = decimal numbers;
  • BOOL = only true or false values;
  • STRING = any type of value understood as a text.

These are the mainly types of variables. Is good for the understanding that others values also can be used. The fact is that, in many cases, a variable already declared cannot simply just receive another type of value.

On the languages inside the plataform .NET for example, all the variables already declared need to receive the values suitable with your kind. Check the example out:

int num = 0;
num = “1”;

On the code above, the compiler won’t be able to read or process this information. It will be necessary to convert the informed value in a round number so the variable won’t have your value altered to 1.

int num = 0;
num = Convert.ToInt32(“1”);

Analyzing the code block above, realize that now the variable won’t be able to receive the round number 1, because the information will be converted by the “Convert” class present firstly on the C# .NET  language. This class, inclusive, offers others conversion methods, not only the round numbers methods.

Even so this is a basic item, errors related to variable conversion are very common and need to be proofread. That’s why it is worthwhile always being attentive to the implemented source code. A language such as PHP and JavaScript does not have this need. Even so, is necessary analyze the code and review any error that can be caused by a error related to the variable.


SCRIPTCASE: What is VS What is not

What is VS What is not What is ScriptCase? It is a fast development environment with tools that f...



We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at Learn more about our Privacy Police.