Asked by Aadil
on 7 Sep 2012

How can I do this without using else if?:

if balls == 0 & ( x > 5 OR y > 7) run xscript end

Thanks,

*No products are associated with this question.*

Answer by Image Analyst
on 7 Sep 2012

Edited by Image Analyst
on 7 Sep 2012

Accepted answer

You need two &&:

if balls == 0 && ( x > 5 || y > 7) % run xscript xscript(); end

Show 2 older comments

Jan Simon
on 7 Sep 2012

Image Analyst
on 7 Sep 2012

Opportunities for recent engineering grads.

## 3 Comments

## José-Luis (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/47600#comment_98082

which else if?

## Aadil (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/47600#comment_98085

what I meant is that I can use else if to do the above, but how can I avoid having to write the commands twice like this:

## José-Luis (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/47600#comment_98087

Image Analyst understood faster and gave you the answer...