Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If / Else statement, how to say "DoNothing" or "Continue" [closed]

Tags:

c#

.net

I have an IF / ELSE statement, although I would like to know how to tell the "else" part to do nothing if it is true. e.g.:

if(x == x) 
 //run calc.exe

else
//DoNothing

Or I am write in saying that if I just remove the else statement, it will continue anyway if the if condition is not matched?

like image 258
Ben Avatar asked Jun 18 '11 16:06

Ben


People also ask

How do you continue an IF ELSE statement?

The continue statement skips the current iteration of the loop and continues with the next iteration. Its syntax is: continue; The continue statement is almost always used with the if...else statement.

What is used to end the if condition statement?

An IF statement is executed based on the occurrence of a certain condition. IF statements must begin with the keyword IF and terminate with the keyword END.

Does else if need an end?

The ending else is not mandatory as far as JavaScript is concerned. As for whether it is needed, it depends on what you want to achieve. The trailing else clause will execute when none of the specified conditions is true.

What is the last statement in an if/then else block?

A block If statement must be the first statement on a line. The Else, ElseIf, and End If parts of the statement can have only a line number or line label in front of them. The block must end with an End If statement.


1 Answers

just omit the else

if(condition)
{
   do_something();
}

//go on with your program
like image 163
Armen Tsirunyan Avatar answered Oct 05 '22 17:10

Armen Tsirunyan