typeof(x)

Read(1532) Label: data type,

Description:

Get data type of the specified variable.

Syntax:

typeof(x)

Note:

The function gets data type of variable x. Supported data types include null, bool, number, bytes(serial byte), datetime, string, blob, sequence, record, table(two-dimensional table).

Parameter:

x

A variable

Option:

@x

When x is number type or date type, it has multiple subtypes:

number type: int, long, float, decimal

date type: date, time, datetime

Return value:

String

Example:

 

A

 

1

 

 

2

=typeof(A1)

null

3

=typeof(true)

bool

4

=typeof(123)

number

5

=typeof("abdfs")

string

6

=typeof(blob([4,7,3]))

blob

7

=typeof(k(1))

bytes

8

=typeof([1,2])

sequence

9

=typeof(now())

datetime

10

=2.new(~:id)

 

11

=typeof(A10)

table

12

=typeof(A10(1))

record

13

=typeof@x(now())

datetime

14

=typeof@x(date(now()))

date

15

=typeof@x(time(now()))

time

16

=typeof@x(123)

int

17

=typeof@x(1.23)

float

18

=typeof@x(long(123232))

long

19

=typeof@x(decimal("123456789012345678901234567890"))

decimal