# What is "invariants of the code"?

"Strong typing" generally refers to use of programming language types in order to both capture invariants of the code

What is "invariants of the code"? There is no link for that

• Please note all the hedging and disclaiming in that article: "generally", "colloquially", "no precise technical definition", "different authors disagree", etc. Also, statements like "Advocates of dynamically typed (generally "weakly typed") languages" are highly problematic, since many dynamically typed languages are indeed considered to be strongly typed by their communities (e.g. Ruby, Python), whereas C is generally considered to be weakly typed, despite being statically typed. Jun 13 '21 at 5:08
• I wrote a little "rant" about those terms here: stackoverflow.com/a/122751/2988 Jun 13 '21 at 5:19

In particular, what I believe the article is referring to here is static type checking, i.e., statements which enforce conditions on the types of variables. Indeed, saying it "excludes certain classes of programming errors" would include errors stemming from (the lack of) type safety. For example, if you have weak typing, a function expecting an argument n to be an integer will only fail at runtime if you pass it a string. With strong typing, you can catch such errors before running the program.