ARCHIVE / What is a dynamically-typed programming language?

All programming languages make use of variables in one form or another.  Variables are essentially labeled containers to hold computer data in memory.  However, different programming languages have different behaviors when it comes to variables and the chief difference is in the handling of different types of data.  Examples of types of data include simple ones such as integers, text strings and decimal values as well as complex ones such as arrays and various other data structures.  No matter which types of data a language supports, a programming language can be distinguished as either being statically-typed or dynamically-typed.  Statically-typed languages require a programmer to define the type of data a variable may contain prior to assigning any data to that variable.  In turn, dynamically-typed languages do not require an assignment of a data type for a given variable.  Instead, the data type is determined as needed.  For example, if we have a variable named var and set the value of var to 4.5, we could then append the text string " points" to var to make the value of var be "4.5 points" using a dynamically-typed language.  In comparison, using a statically-typed language with a variable var and a decimal value of 4.5 we would need to create a new variable to store the string combining var with " points" rather than being able to store the new string in var itself given that var was defined as a decimal value.

last updated 2007.10.13

RELATED TOPICS

 

Terms of Use · Privacy Policy ©2021