Ask Question
30 March, 22:43

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. 30 March, 23:06
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers