Operators and Conditional Statements in LoadRunner

Operators:Operators are the symbols which tell the computer to execute certain mathematical or logical operations.  A mathematical or logical expression is generally formed with the help of an operator.

Aritmetic Operators: C programming language/LoadRunner provides all basic arithmetic operators: +, -, *, / and %(Modulo).

Relational Operators: Relational operators are used when we have to make comparisons. C programming offers 6 relational operators.

Logical Operators: Logical operators are used when more than one conditions are to be tested and based on that result, decisions have to be made. C programming offers three logical operators. They are:

Increment/Decrement Operators: 

C programming allows the use of ++ and  operators which are increment and decrement operators respectively. Both the increment and decrement operators are unary operators. The increment operator ++ adds 1 to the operand and the decrement operator – subtracts 1 from the operand. The general syntax of these operators are:

Increment Operator: x++ or ++x;

Decrement Operator: x–or –x;

In the example above, x++ simply means x=x+1; and m– simply means x=x-1;

For example,

X=10;
Y=++X;

In this case, the value of X and Y will be 6.

And,

X=10; Y=X++;
In this case, the value of Y will be 10 and the value of X will be 11.

 

Boolean Expression: A boolean expression is an expression that has relational
and/or logical operators operating on boolean variables. A boolean expression
evaluates to either true or false.

We will be discussing some boolean expression in the following section:

 

Discussion From the class:

Operators and Conditional Statements in LoadRunner

Hopefully you understood the above lessons and solve the following:

Q1. If a=-10, b=100, c=-5. Find the value for res = !( a<c && (b>=c*a)) .
Q2. If p = .5, q=.25, r =.75 and z=.3. Find the value of the following expression:

res =! (!(q<=p) ||(q>=r))

Modulo operator(%): Calculates the remainder of division operations.
For example: a= 12 and b=5. Then a%b =12%5= 2
x= 37 y= 8 then x%y= 37%8= 5.
Q3. r=12, s=4, n= 25, m= 8 find the value of res= ((r%s)>=0 && (n%m)<1))

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*