Top
Back: 5.1.129 type
Forward: 5.1.131 uressolve
FastBack: 5. Functions and system variables
FastForward: 6. Tricks and pitfalls
Up: 5.1 Functions
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

5.1.130 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(_);
→ none
  type i;
→ // i                    [0]  int 9
  typeof(_);
→ string
  string s=typeof(i);
  s;
→ int
  typeof(s);
→ string
  proc p() {  "hello"; return();}
  p();
→ hello
  typeof(_);
→ none

See Data types; type.


Top Back: 5.1.129 type Forward: 5.1.131 uressolve FastBack: 5. Functions and system variables FastForward: 6. Tricks and pitfalls Up: 5.1 Functions Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.