• Nothing
  • About
Menu

Asher Einhorn

  • Nothing
  • About
strong-vs-weak-cultures.jpg

Strongly vs Weakly typed languages

June 19, 2015

The following is one of a series of bite-sized lessons on useful programming terminology. Understanding these things can eventually help you learn new languages very quickly by making educated assumptions about how they work.

You may have heard of the concept of strongly or weakly typed programming languages. Although these concepts are not rigidly defined, the following is a mostly agreed upon definition of the differences between them.

Strongly typed

  • must define the type (integer, string, float, etc.)
  • For example, in C++ you declare a type inline or before you use a variable int myInteger = 1;
  • may produce errors if the data passed is not exactly, or close to the expected type
    int myInteger = “string”; //ERROR

Weakly typed
(also called ‘dynamically typed’, 'loosely-typed' or 'type-fluid')

  • don’t need to define type
  • For example, in Javascript
  • may perform implicit type conversions
  • more likely to produce undefined behavior than errors, but variables are not limited to a single data-type in their lifecycle


    var myVariable = 5;
    myVariable = “string”;

In Scripting Handbook
← Delta timeUnderstanding and working with radians →
Twitter
  • RT @CKapmeh: Sunday Capilla San Bernardo / Nicolás Campodonico https://t.co/V56q7uftPf
    May 28, 2017, 10:42 AM
  • Crunch dadaism. Come to @Naughty_Dog and experience the highs of creative culture. https://t.co/9yMPcTdiYA
    May 27, 2017, 9:33 AM
  • Crunch garden #gamedev Avocado, Lemon and Peppers. From right to left. https://t.co/jtZXeWDEgh
    May 27, 2017, 9:31 AM
  • Working with a migraine two days in a row is quite possibly the most unpleasant thing in recent memory.
    May 26, 2017, 3:36 PM
  • Sure is fun to have a night off! #PS4share https://t.co/WMcEMY5yWE
    May 21, 2017, 7:59 PM
  • The EU/US PSN account conflict is an ongoing nightmare. Looks like I'm not playing anything tonight after all.... pain!
    May 21, 2017, 7:49 PM