C++ 'do nothing' command?

Hello

Just a quick question, is there a command similar to the Python command "pass" which does absolutely nothing other than be a place holder for something in the future?

For example, say I am writing an if statement:
if (x == 1)
do something
else
do something else

I know I need the if statement, but I don't want to write the actual things to do yet. Is there a command I can put in to stop the compiler errors, but that will not actually do anything?

I could comment it out, but I was wondering if there is another way.
Yes. ; Makes sense right?
1
2
3
int x = 0;
while( x++ < 10 ); //notice the empty statement (lone semicolon) following the while-loop
cout << x;
10

You could also just use an empty block:
1
2
3
4
5
6
if( x == 1 ) {
} else {
}
//or
if( x == 1 ) {}
else {}
Oh, wow, I didn't know it was that easy! Thanks!
Just to make the intention explicit, I put the semicolon where the command would be, on the line below the conditional/loop, indented:

1
2
for(i = 0; i < 10; ++i)
	;
closed account (1vRz3TCk)
Just to make the intention explicit...
use continue in loops e.g.
1
2
3
4
int x = 0;
    while( x++ < 10 )
        continue; 
    cout << x;


Don't do nothing silently.
Topic archived. No new replies allowed.