Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Loops-Nested/Octave/loops-nested.octave
Normal file
30
Task/Loops-Nested/Octave/loops-nested.octave
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
function search_almost_twenty()
|
||||
% create a 100x100 matrix...
|
||||
m = unifrnd(0,20, 100,100);
|
||||
for i = 1:100
|
||||
for j = 1:100
|
||||
disp( m(i,j) )
|
||||
if ( abs(m(i,j) - 20) < 1e-2 )
|
||||
return
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
search_almost_twenty()
|
||||
|
||||
% avoiding function, we need a control variable.
|
||||
m = unifrnd(0,20, 100,100);
|
||||
innerloopbreak = false;
|
||||
for i = 1:100
|
||||
for j = 1:100
|
||||
disp( m(i,j) )
|
||||
if ( abs(m(i,j) - 20) < 1e-2 )
|
||||
innerloopbreak = true;
|
||||
break;
|
||||
endif
|
||||
endfor
|
||||
if ( innerloopbreak )
|
||||
break;
|
||||
endif
|
||||
endfor
|
||||
Loading…
Add table
Add a link
Reference in a new issue