Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

static languages

Static vs dynamic languages

Aymen Bashir

Static languages

In static languages, the type can not be changed once a variable is created. If a variable type is defined, then only the value of the variable can be changed, but the type is static and cannot be changed. This means that if we define an integer, we can only update its value and no other data type can be assigned to it.

This makes the code robust since type-checking is done during compile-time. Static languages might have a slow development cycle due to an extra step of compilation. Moreover, while accessing a variable, the data type is already known, which avoids the need for extra checks.

C++, Java, Go and C# are statically typed languages.

Dynamic languages

In dynamic languages, the types and values are both dynamic, which means the types and values can both be changed. For example, a variable that was previously assigned an integer can be assigned a string. The type checking is done during run time.

The dynamic languages are usually not compiled, but interpreted. Due to the dynamic types, there might be increased chances of type errors. However, due to the absence of the compilation step, the development is fast.

JavaScript, Ruby, and PHP are examples of dynamically typed languages.

RELATED TAGS

static languages

CONTRIBUTOR

Aymen Bashir
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring