What is the difference between statically typed and dynamically typed languages?

后端 未结 16 2194

I hear a lot that new programming languages are dynamically typed but what does it actually mean when we say a language is dynamically typed vs. statically typed?

16条回答
  •  醉梦人生
    2020-11-22 01:54

    Statically typed languages: each variable and expression is already known at compile time.

    (int a; a can take only integer type values at runtime)

    Examples: C, C++, Java

    Dynamically typed languages: variables can receive different values at runtime and their type is defined at run time.

    (var a; a can take any kind of values at runtime)

    Examples: Ruby, Python.

提交回复
热议问题