Data Types - MikroTik RouterOS v2.9 Reference Manual

Reference manual
Table of Contents

Advertisement

[admin@MikroTik] interface> :put (1 . 3)
13
[admin@MikroTik] interface> :put (1,2 . 3)
1,2,3
[admin@MikroTik] interface> :put (1 . 3,4)
13,4
[admin@MikroTik] interface> :put (1,2 . 3,4)
1,2,3,4
[admin@MikroTik] interface> :put ((1 . 3) + 1)
14
[admin@MikroTik] interface>

Data types

Description
The RouterOS console differentiates between several data types, which are string, boolean, number,
time interval, IP address, internal number and list. The console tries to convert any value to the
most specific type first, backing if it fails. The order in which the console attempts to convert an
entered value is presented below:
list
internal number
number
IP address
time
boolean
string
Internal scripting language supplies special functions to explicitly control type conversion. The
toarray, tobool, toid, toip, tonum, tostr and totime functions convert a value accordingly to list,
boolean, internal number, IP address, number, string or time.
The number type is internally represented as 64 bit signed integer, so the value a number type
variable can take is in range from -9223372036854775808 to 9223372036854775807. It is possible
to input number value in hexadecimal form, by prefixing it with 0x, e.g.:
[admin@MikroTik] > :global MyVar 0x10
[admin@MikroTik] > :put $MyVar
16
[admin@MikroTik] >
Lists are treated as comma separated sequence of values. Putting whitespaces around commas is not
recommended, because it might confuse console about words' boundaries.
Boolean values can be either true or false. Console also accepts yes for true, and no for false.
Internal numbers are preceided * sign.
Time intervals can be entered either using HH:MM:SS.MS notation, e.g.:
[admin@MikroTik] > :put 01:12:1.01
01:12:01.010
[admin@MikroTik] >
Page 638 of 695
Copyright 1999-2007, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA.
Other trademarks and registred trademarks mentioned herein are properties of their respective owners.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents