Ask Question
22 March, 19:29

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

+2
Answers (1)
  1. 22 March, 22:34
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers