Jump to content

Change variable type


chiprivers

Recommended Posts

Is it possible to change the type that a variable is being stored as?

 

I have a var which is behaving like a string but contains a number.  I am assuming that it is behaving like a string due to the way that its value is extracted and applied to the var.

 

Below is an example to demonstrate what I mean by behaving like a string:

var x = 10000;
var y = 999;

var z = x + y;

 

In my script, the above value for z is displaying as 10000999 when I want it to be adding the values so should be 10999.

 

Is there a way that once a var has a value applied, if it is stored as a string, I can change it to be numerical?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.