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

Hb programming test, The purpose of the HB Programming test is to assess wh...

The purpose of the HB Programming test is to assess whether a candidate has sufficient knowledge to join our team here and beyond that where they would fit within our teams. The

Html code to create a web page design , 1.  Develop HTML code to create a W...

1.  Develop HTML code to create a Web page with the red background and title "My First Page" in any other color. 2.  Develop an HTML document with details of your name, telephon

Describe informally how to draw a pda diagram, Suppose L is a context-free ...

Suppose L is a context-free language and L' is regular. Show that L∩ L' is a context- free language. Specifically, if you're given a PDA diagram of L and a DFA diagram for L' , des

Define a prolog predicate flatten, Define a Prolog predicate flatten(List, ...

Define a Prolog predicate flatten(List, FlattenedList) that asserts List is any nested list of atoms and FlattenedList is the same list with the nesting removed. The atom [] should

Linux commans, Corrected Exercise #1: 1. Explain the following unexpected r...

Corrected Exercise #1: 1. Explain the following unexpected result: why did you get the system date command instead of the script? $ whereis date date: /bin/date ... $ echo $PATH

Calculate the appropriate weight for each query term, 1-Create ir3.py based...

1-Create ir3.py based on ir2.py 2-Repeatedly prompt the user for a query (if they enter "q", then quit) 3-Find the terms in the query, and calculate the appropriate weight fo

Matlab help, i(t)=(V/R) * (1-e^-(R/L)(t)) (a) Defi ne an anonymous function...

i(t)=(V/R) * (1-e^-(R/L)(t)) (a) Defi ne an anonymous function answerE that returns i(t) given input t. (b) The fi nal value for the current is 2 amps. Find a time tm when the curr

Lalr parser - xml table output, LALR Parser: Rule Table - Contains de...

LALR Parser: Rule Table - Contains definitions of production rules within the grammar. Attributes: Count - Number of production rules in the table Child items:

Expression Tree, For this assignment you will read a file expression.txt an...

For this assignment you will read a file expression.txt and create an expression tree. The expression will be a valid infix expression with the all the necessary parentheses so tha

Explain the goto statement - computer programming, Explain the Goto Stateme...

Explain the Goto Statement - Computer Programming? The goto statement is employed to alter the normal sequence of program execution by transferring control to some other part o

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