DEV Community

Cover image for Static vs Dynamic Typing
Odai Athamneh
Odai Athamneh

Posted on

Static vs Dynamic Typing

Photo by israel palacio on Unsplash


There are 2 separate concepts to understand:

  1. Strong vs Weak - Can variables change type?
    • Strong says no.
    • Weak says yes.
  2. Static vs Dynamic - When do we check variable type?
    • Static checks at compile time.
    • Dynamic checks at runtime.

Examples

💪 Strong 😖 Weak
🥶 Static Java, C++ ?
👟 Dynamic Python, Ruby JavaScript, PHP

Top comments (2)

Collapse
 
simeg profile image
Simon Egersand 🎈

Perfect summary! Short and sweet.

Collapse
 
heyodai profile image
Odai Athamneh

Thanks so much! That's what I was going for