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.

You might also like…

Scriptcase & Web Services

This time I will explain how to work with web services inside the Scriptcase, directly with PHP and...

More updates in 9.4 version

Recently version 9.4 was released bringing a new design concept to the generated applications of Sc...

Taking a look at version 9.4

Scriptcase released its version 9.4, and this one brings many interesting news, specially regarding...

Comment this post

Get new posts, resources, offers and more each week.

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.