two loops to single loop

EDITED
i have two loops ie.
if (n==null)
{

do loop 1

}
else //(n=!null)
{

do loop2

}

now i have to update the above code, with a single loop ie. when n==null or n!=null do the loop 1

how can i update.?

can i do like this
if(n==null ||n=!null)
{

do loop 1

}

is || operator above does the job what i expected
pls. check and let me know some ideas

thanks
Last edited on
No, that's actually impossible.

It's not possible for n to equal both null and not null.

Unless, of course, you live in a crazy universe where null is equal to not null. I'm reasonably sure your world would implode in this instance.
Last edited on
@iHutch105 sorry i updated my question, pls check whether it can done like that
Yes it can.

Two things to consider, though:

1) The not equals operator is !=, not =!.

2) If you want the loop to run if n is not or not null, then you want it to run regardless, so why do you need a check at all?
i think you can just...

do loop 1
do loop 2

no check necessary
Topic archived. No new replies allowed.