Assignment; Increment And Decrement - Juniper JUNOSE SOFTWARE FOR E SERIES 11.3.X - SYSTEM BASICS CONFIGURATION GUIDE 2010-10-04 Configuration Manual

Software for e series broadband services routers system basics configuration guide
Hide thumbs Also See for JUNOSE SOFTWARE FOR E SERIES 11.3.X - SYSTEM BASICS CONFIGURATION GUIDE 2010-10-04:
Table of Contents

Advertisement

JunosE 11.3.x System Basics Configuration Guide
Example
Example 1
Example 2
468
Table 53: Operator Actions (continued)
Operation
Preincrement
Predecrement
Negation
Arithmetic (unary)
Arithmetic (unary)
Substring
Randomize
Round
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.
<# 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.
<# 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.
<# i := 0; j := 10 #>
<# j := j - ++i #>
Operator
Action
++
Increments the variable before the expression is
evaluated
– –
Decrements the variable before the expression is
evaluated
!
Reverses the logical state of its operand. 0 is returned
for nonzero operands. 1 is returned for operands that
evaluate to zero.
+
Provides the absolute value of the value
Provides the inverse of the value
substr()
Extracts a portion of a string
rand()
Generates a random integer between the provided
endpoints, inclusive
round()
Rounds the value to the nearest integer
truncate()
Truncates a noninteger value to the value left of the
decimal point
Copyright © 2010, Juniper Networks, Inc.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Junose 11.3

Table of Contents