Ask Question
29 May, 13:02

When do you use an else statement?

To Input a variable

To tell what will happen when an if-statement is false.

To end an IF statement.

To handle string values

+3
Answers (1)
  1. 29 May, 16:33
    0
    To tell what will happen when an if-statement is false

    Explanation:

    We use else statement if if-statement get false.

    for example

    if (a>20)

    {

    print "your age is greater than 20"

    }

    else

    {

    print "Your age is less than 20"

    }

    In the pseudo code, you see the use of else statement, that if age is greater than 20 then display message "you are age is greater than 20". if this statement get false, i. e. you are age is not greater than 20 then else statement will be executed and message will be displayed that your age is less than 20.

    Why other option are not correct

    To input a variable:

    to get input, we use input statement of respective programming language not if-else statement.

    To end an if statement

    we don't use else statement to end if statement. when condition met then if statement will be ended

    To handle string value

    we use input validation statement to handle if statement.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “When do you use an else statement? To Input a variable To tell what will happen when an if-statement is false. To end an IF statement. To ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers