Miscellaneous Operations - Juniper SYSTEM BASICS - CONFIGURATION GUIDE V 11.1.X Configuration Manual

System basics configuration guide software for e series broadband services routers
Table of Contents

Advertisement

1. For the logical NOT, the result of the operation is true (1) if it evaluates to zero, or
false if it evaluates to nonzero.
Example
<# i := 6; i >= 3 && i <= 10 #>The result is 1
<# i := 1; i >= 3 && i <= 10 #>The result is 0
<# i := 6; i >= 3 || i <= 10 #>The result is 1
<# i := 1; i >= 3 && i <= 10 #>The result is 0
<# i := 5; !i #> The result is 0
<# i := 5; j := 0; !i && !j #>The result is 0
<# i := 5; j := 0; !i || !j #>The result is 1
Relational operators have a higher precedence than logical AND and OR. The NOT
operator is equal in precedence to the increment and decrement operators.

Miscellaneous Operations

The positive (+) and negative (-) operations must precede the operand. The result
of a positive operation is the absolute value of the operand. The result of a negative
operation is the negative value of the operand; that is, a +(-5) becomes 5 and a -(-2)
becomes 2. These operators have the same precedence as the increment and
decrement operators. If there is an operand on both sides of these operators, they
are interpreted as the add and subtract operators.
Example
<# local_abs := +local #>
<# local_neg := -local #>
All operations are performed in the order implied by the precedence of the operators.
However, you can modify this order by using parentheses (( )) to group operands
and operators. Operations within parentheses are performed first. The result is that
of the operations within the parentheses.
Example
<# 4 % (3 + 12) - 6 #>The result is -6
<# 5 && 2 > 1 #>The result is 1
<# (5 && 2) > 1 #>The result is 0
Results of control expressions are written to the output stream when the expression
consists of the following:
A single local variable
A single literal element
An operation whose result is not used by one of the following operations:
assignment
if
Example
<# localvar #>value of localvar is written
<# " any string" #>"
<# 4 % 3 + 12 - 6 #>" 7"
<# 4 % (3 + 12) - 6 #>" -6"
predecrement
postdecrement
preincrement
postincrement
any string"
written
is written
is written
Chapter 8: Writing CLI Macros
while
Writing Macros
485

Advertisement

Table of Contents
loading

This manual is also suitable for:

Junose 11.1

Table of Contents