Table 53: Operator Actions
(continued)
Action
Operator
Operation
Increments the variable before the expression is
evaluated
++
Preincrement
Decrements the variable before the expression is
evaluated
– –
Predecrement
Reverses the logical state of its operand. 0 is returned
for nonzero operands. 1 is returned for operands that
evaluate to zero.
!
Negation
Provides the absolute value of the value
+
Arithmetic (unary)
Provides the inverse of the value
–
Arithmetic (unary)
Extracts a portion of a string
substr()
Substring
Generates a random integer between the provided
endpoints, inclusive
rand()
Randomize
Rounds the value to the nearest integer
round()
Round
Truncates a noninteger value to the value left of the
decimal point
truncate()
Truncate
Assignment
Use the assignment operator (:=) to set the value of a local variable. The expression to
the right of the operator is evaluated, and then the result is assigned to the local variable
to the left of the operator. The expression to the right of the operator can include the
local variable if you want to modify its current value.
Example
<# i := i + 1 #>
<# count := count - 2 #>
Increment and Decrement
You can use the increment operator (++) to increase the value of a local variable by one.
You specify when the value is incremented by the placement of the operator. Incrementing
occurs after the expression is evaluated if you place the operator to the right of the
operand. Incrementing occurs before the expression is evaluated if you place the operator
to the left of the operand.
Example 1
<# i := 0; j := 10 #>
<# j := j - i++ #>
In Example 1, the result is that
i
equals 1 and
j
equals 10, because the expression is
evaluated (10 – 0 = 10) before
i
is incremented.
Example 2
<# i := 0; j := 10 #>
<# j := j - ++i #>
Copyright © 2010, Juniper Networks, Inc.
468
JunosE 11.3.x System Basics Configuration Guide
Содержание JUNOSE 11.3
Страница 6: ...Copyright 2010 Juniper Networks Inc vi...
Страница 8: ...Copyright 2010 Juniper Networks Inc viii JunosE 11 3 x System Basics Configuration Guide...
Страница 24: ...Copyright 2010 Juniper Networks Inc xxiv JunosE 11 3 x System Basics Configuration Guide...
Страница 32: ...Copyright 2010 Juniper Networks Inc 2 JunosE 11 3 x System Basics Configuration Guide...
Страница 146: ...Copyright 2010 Juniper Networks Inc 116 JunosE 11 3 x System Basics Configuration Guide...
Страница 166: ...Copyright 2010 Juniper Networks Inc 136 JunosE 11 3 x System Basics Configuration Guide...
Страница 432: ...Copyright 2010 Juniper Networks Inc 402 JunosE 11 3 x System Basics Configuration Guide...
Страница 488: ...Copyright 2010 Juniper Networks Inc 458 JunosE 11 3 x System Basics Configuration Guide...
Страница 524: ...Copyright 2010 Juniper Networks Inc 494 JunosE 11 3 x System Basics Configuration Guide...
Страница 554: ...Copyright 2010 Juniper Networks Inc 524 JunosE 11 3 x System Basics Configuration Guide...
Страница 566: ...Copyright 2010 Juniper Networks Inc 536 JunosE 11 3 x System Basics Configuration Guide...
Страница 588: ...Copyright 2010 Juniper Networks Inc 558 JunosE 11 3 x System Basics Configuration Guide...
Страница 613: ...PART 3 Index Index on page 585 583 Copyright 2010 Juniper Networks Inc...
Страница 614: ...Copyright 2010 Juniper Networks Inc 584 JunosE 11 3 x System Basics Configuration Guide...
Страница 632: ...Copyright 2010 Juniper Networks Inc 602 JunosE 11 3 x System Basics Configuration Guide...