up previous next
Type

the data type of an expression

Syntax
Type(E:OBJECT):TYPE

Description
This function returns the data type of E. The function Types returns the list of CoCoA data types.

Example
Define CollectInts(L)
  Result := [];
  Foreach X In L Do
    If Type(X) = INT Then Append(Result,X) EndIf
  EndForeach;
  Return Result
EndDefine;

CollectInts([1,"a",2,"b",3,"c"]);
[1, 2, 3]
-------------------------------
Type(Type(INT));  -- Type returns a value of type TYPE
TYPE
-------------------------------
Types();
[NULL, BOOL, STRING, TYPE, ERROR, RECORD, DEVICE, INT, RAT, ZMOD,
POLY, RATFUN, VECTOR, IDEAL, MODULE, MAT, LIST, RING, TAGGED(""),
FUNCTION] 
------------------------------- 


See Also