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.

By ,

January 9, 2014


You might also like…

5 reasons you can’t miss a Black Friday Scriptcase!

This November we bring you the biggest and most important discounts of the year! And do you know wh...

Taking a look at Scriptcase version 9.7

After the big Scriptcase 9.7 presentation event, we have a new version of Scriptcase for download, ...

October Newsletter

Follow the latest news for the month of October! Webinars, blog posts, videos, and more. WEB...

You might also like…

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.