0
How to execute if and else condition at same time?
11 Réponses
+ 3
What are you trying to accomplish? By the nature of if / else, you want it to do one or the other, based upon those conditions.
If you want it to execute the code for both, if either condition is true, then just use the OR operator.
if(this || that)
{
do all of this;
}
I just realized you didn't specify what lang you're working with. My example is just pseudo for C oriented languages that uses that type of syntax. Same concept applies to most.
+ 1
You want it to check the condition or you want it to execute the code for both?
+ 1
we can execute in C
if(printf("if")==0)
printf(" if");
else
printf(" else");
try this.
+ 1
But why do you want to do that?
+ 1
my friend asked me that question so I posted in this
0
can you give one example ?
0
i
I mean that I want to execute both if and else at same time
0
if(!printf("good"))
{
printf("good");
else{
printf("bad");
}
this prints goodbad
0
the code above is not executing in java it shows some error
0
I want to execute for both
0
Sorry but this is stupid and senseless.