Skip to content
EntityQ7860933· pop 5· linked from 17 articles

', alternately also , and ', is an operator provided by several programming languages to determine the data type of a variable. This is useful when constructing programs that must accept multiple types of data without explicitly specifying the type.

~4 min read

Encyclopedic overview

11 sections
Contents
  • Examples
  • C
  • C++
  • C#
  • Java
  • JavaScript
  • TypeScript
  • Python
  • VB.NET
  • See also
  • References

', alternately also , and ', is an operator provided by several programming languages to determine the data type of a variable. This is useful when constructing programs that must accept multiple types of data without explicitly specifying the type.

In languages that support polymorphism and type casting, the typeof operator may have one of two distinct meanings when applied to an object. In some languages, such as Visual Basic, the typeof operator returns the dynamic type of the object. That is, it returns the true, original type of the object, irrespective of any type casting. In these languages, the typeof operator is the method for obtaining run-time type information.

Excerpted from Wikipedia’s “typeof” article, available under the CC BY-SA 4.0 licence.

Available in 4 languages

via Wikidata sitelinks · CC0