Dynamic typing vs Static typing

최유민·2022년 9월 22일

개념

목록 보기
1/2

Dynamic typing vs Static typing

First, dynamically-typed languages perfom type checking at runtime, while statically-typed languages perform type checking at compile time.

this means that scripts written in dynamically-typed languages can compile even if they contain errors that will prevent the script from running properly (if at all). If a script written in a statically-typed language contains errors, it will fail to compile until the errors have been fixed.

Second, statically-typed languages require you to declare the data types of your variables before you use them, while dynamically-typed languages do not.

(Statically-typed language) Java example :
int num;
num = 5;

(Dynamically-typed language) Groovy example :
num = 5

Dynamically-typed languages are more flexible and can save you time and space when writing scripts. However, this can lead to issues at runtime.

reference

0개의 댓글