### 5.1.161 typeof

`Syntax:`
  `typeof (` expression `)`
`Type:`
  string
`Purpose:`
  returns the type of an expression as string.

  Returns the type of the first list element if the expression is an expression list.

  Possible types are: `"ideal"`, `"int"`, `"intmat"`, `"intvec"`, `"list"`, `"map"`, `"matrix"`, `"module"`, `"number"`, `"none"`, `"poly"`, `"proc"`, `"qring"`, `"resolution"`, `"ring"`, `"string"`, `"vector"`.

  For internal use only is the type `"?unknown type?"`.

`Example:`

        int i=9; i;
      ==> 9
        typeof(_);
      ==> int
        print(i);
      ==> 9
        typeof(_);
      ==> string
        type i;
      ==> // i int 9
        typeof(_);
      ==> string
        string s=typeof(i);
        s;
      ==> int
        typeof(s);
      ==> string
        proc p() {  "hello"; return();}
        p();
      ==> hello
        typeof(_);
      ==> ?unknown type?

See Data types; type.

User manual for Singular version 4.4.1, 2025, generated by texi2html.