Define the if - else statement - computer programming, Programming Languages

Assignment Help:

Define the If - else statement - computer programming?

The If - else statement

The universal form of if - else statement is

                        if(expression)

                        {

                                    statements 1;

                        }

                        else

                        {

                                    statements 2;

                        }

If  the 'expression' returns a true, then it will execute statements 1 otherwise if it returns false, then it will execute statements 2. The statements are able to be simple or compound statements.

634_Define the If - else statement - computer programming.png

Flowchart of if - else statement

For instance

                        if(x>10)

                        {         

                                    x=x+1;

                        }

                        else

                        {

                                    x=x-1;

                        }

If the value of x is greater than 10, it will execute x=x+1. I the value of x is less than 10, then it will execute x=x-1.


Related Discussions:- Define the if - else statement - computer programming

Count no of files, Normal 0 false false false EN-US X...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

A traveler wants to purchase a number of traveler''s checks, A traveler wan...

A traveler wants to purchase a number of traveler''s checks, each having a set amount for four different currencies: Mexican pesos, Euro dollars, Swiss francs, and US dollars. A t

Pascal, how do i make a bomber game using pascal on a software called lazur...

how do i make a bomber game using pascal on a software called lazuras

What do you understand by the term postback, Question: (a) What do you...

Question: (a) What do you understand by the term Postback? (b) Describe five benefits of creating virtual directories while developing an ASP.NET application. (c) Exp

Create a structure to represent deck of cards, We want to create a structur...

We want to create a structure that will represent a deck of cards (not necessarily full). Each card has a character (between '2' to '9' and 'T', 'J', 'Q', 'K', 'A') and a suit (dia

Prolog predicate to remove nth element, Write a Prolog predicate remove_nth...

Write a Prolog predicate remove_nth(N,L1,L2) that is true if list L2 is just list L1 with its Nth element removed. If L1 does not have an Nth element then the predicate should fail

C, Is it possible to get an assignment done within 2 hours

Is it possible to get an assignment done within 2 hours

What are the Functions in Computer Programming, What are the Functions in C...

What are the Functions in Computer Programming? A program is completed up of one or more functions, with one of these being main(). Function is a self-contained block of progra

Depth estimation, depth estimation from block matching algorithm motion est...

depth estimation from block matching algorithm motion estimation

Lexical analyzer - xml table output, Lexical Analyzer: Symbol Table - Ho...

Lexical Analyzer: Symbol Table - Holds the symbols accepted by the lexical analyzer or parser.  Each symbol may be a terminal or a non-terminal.  Terminal symbols are listed

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd