type/literal - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/literal

type/literal

check for an object of type literal

 Calling Sequence type(x, literal)

Parameters

 x - any expression

Description

 • The call type(x, literal) checks to see if x is of type literal. It returns true if x is of type literal, and false otherwise.
 An object is of type literal if it is of type integer, fraction, float, complex(numeric), or string.
 • To verify whether an expression identically matches a specified expression, use the type/identical command.

Examples

 > $\mathrm{type}\left(1,\mathrm{literal}\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{type}\left(\frac{1}{2},\mathrm{literal}\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{type}\left(0.5,\mathrm{literal}\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{type}\left("String",\mathrm{literal}\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{type}\left(\mathrm{Name},\mathrm{literal}\right)$
 ${\mathrm{false}}$ (5)
 > $\mathrm{type}\left({a}_{b},\mathrm{literal}\right)$
 ${\mathrm{false}}$ (6)
 > $\mathrm{type}\left(\frac{a}{b},\mathrm{literal}\right)$
 ${\mathrm{false}}$ (7)
 > $\mathrm{type}\left(2+\frac{4I}{7},\mathrm{literal}\right)$
 ${\mathrm{true}}$ (8)