1. ## Question in matlab

Hi All
I want to ask question in matlab, Can I create if loop inside for loop such that if on condition of if hold then for loop must end, i.e How can we do the following
For i = 1:2:10
if mod(i,2)=0
end
else
i
end

Best wishes

2. Originally Posted by raed
Hi All
I want to ask question in matlab, Can I create if loop inside for loop such that if on condition of if hold then for loop must end, i.e How can we do the following
For i = 1:2:10
if mod(i,2)=0
end
else
i
end

Best wishes

Code:
for i=1:2:10
if mod(i,2)==0
break
else
i
end
end