HyperMath

Dynamic Typing

Dynamic Typing

Previous topic Next topic No expanding text in this topic  

Dynamic Typing

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

When creating variables, you do not have to specify which type of variable you are creating.  This is called dynamic typing.  The variable knows what type it is from the value, or object, assigned to it.  For example:

> a = 1

> b = "hello"

As well as not having to specify the type of variable, you can assign different value types to the same variable. For example:

> a = 1 // a is assigned a numeric value

> print(a)

1

 

> a = "hello" //a is assigned a string value

> print(a)

hello