• No products in the cart.

What are the different options in conditional statements?

Arithmetic Oprations:

Arithmetic operations are basic mathematical operations that can be performed on numerical values. Here are some common arithmetic operations:

1. Addition: The addition operator (+) is used to add two or more numerical values together. For example, 2 + 3 = 5.
2. Subtraction: The subtraction operator (-) is used to subtract one numerical value from another. For example, 5 – 3 = 2.
3. Multiplication: The multiplication operator (*) is used to multiply two or more numerical values together. For example, 2 * 3 = 6.
4. Division: The division operator (/) is used to divide one numerical value by another. For example, 6 / 3 = 2.
5. Modulo: The modulo operator (%) is used to find the remainder of a division operation. For example, 7 % 3 = 1, because 7 divided by 3 leaves a remainder of 1.
6. Exponentiation: The exponentiation operator (^ or **) is used to raise a value to a power. For example, 2^3 = 8.

In addition to these basic arithmetic operations, some programming languages also support more complex operations such as bitwise operations, logarithms, and trigonometric functions. The specific syntax and behavior of each operation may vary depending on the programming language being used.

logical options:

If you are referring to logical operators or logical expressions, here are some commonly used ones:

1. AND operator: The AND operator (&& or &) is used to combine two or more logical expressions so that the resulting expression is true only if all the component expressions are true.

Example:

if age > 18 & gender = ‘Male’ then

  do;

    /* some code */

  end;

2. OR operator: The OR operator (|| or |) is used to combine two or more logical expressions so that the resulting expression is true if any one of the component expressions is true.

Example:

if age > 18 | gender = ‘Male’ then

  do;

    /* some code */

  end;

Example:

if age > 18 | gender = ‘Male’ then

  do;

    /* some code */

  end;

3. NOT operator: The NOT operator (!) is used to negate a logical expression, so that a true expression becomes false and vice versa.

Example:

if not (age > 18) then

  do;

    /* some code */

  end;

4. Comparison operators: Comparison operators are used to compare two values and produce a logical result. Some commonly used comparison operators are:
• Equal to (== or =)
• Not equal to (!= or ^=)
• Greater than (>)
• Less than (<) • Greater than or equal to (>=)
• Less than or equal to (<=)

Example:

if score >= 90 then

  do;

    /* some code */

  end;

These are just a few of the many logical operators and expressions that are available in programming. The specific syntax and behavior of each operator may vary depending on the language being used.

21/02/2023
Template Design © Bodhan soft technologies PVT.LTD. All rights reserved. <meta name="facebook-domain-verification" content="cg6nsg7wc0h385jtk0v0gswpb924ti" />

Connect with :




Chat with Us
1
We are Online
Hello ,
How we can help you ?