Skip to content

Instantly share code, notes, and snippets.

@Babali42
Created January 15, 2025 10:51
Show Gist options
  • Save Babali42/8282bf3b8d443ff30b08c706432d789f to your computer and use it in GitHub Desktop.
Save Babali42/8282bf3b8d443ff30b08c706432d789f to your computer and use it in GitHub Desktop.
Introduction au typage par Gwennan

Le typage dans les langage de programmation

Statique vs dynamique

Typage dynamique

  • Le type peut changer au cours du temps

Typage statique

  • Ta variable a le même type tout le temps

Les langages compilés ont tendance à avoir un typage fort et les langages interprétés ont tendance à avoir un typage dynamique

Fort vs faible

Typage fort

  • tu fais très attention au type

Typage faible

  • tu mélange un float et un int

typage fort i8 i16 x + y -> NOPE

typage faible string + ptr -> ok tkt

Example de langages

C a un typage faible, comme javascript Le langage défini les règles du typage faible

//Opération de typage faible en c# Console.WriteLine("Hello World" + 3);

js : type faible

"toto" + 3 "toto3"

"toot" - 3 NaN

"4" - 3 1

  • "4" -4

"4" + 10 "410"

0 == "" true

0 == [] true

[] == "" true

C

Typage statique et faible

Haskell

Typage statique et fort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment