12.07.2015 Views

CAD in Civil Engineering - Baustatik-Info-Server

CAD in Civil Engineering - Baustatik-Info-Server

CAD in Civil Engineering - Baustatik-Info-Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Page 32 Computer Languages for Eng<strong>in</strong>eer<strong>in</strong>g - SS 132.8.4 Implicit, General Loop without a Control Structure <strong>in</strong> 90+In Fortran 90 the do ... end do statement can be used without any control elements too, so thebreak condition of the look has to be implemented manually by the usage of an if statement (see section2.9 too). If we compare the list<strong>in</strong>gs 2.15 with 2.16, we see, that <strong>in</strong>crement<strong>in</strong>g the loop counter has to bedone manually as well as it’s <strong>in</strong>itialization. Us<strong>in</strong>g an implicit (general) loop we have to be careful withthe break condition, so that we avoid hang<strong>in</strong>g <strong>in</strong> an endless loop.List<strong>in</strong>g 2.16: Break<strong>in</strong>g a general 90-Loop1 program GeneralLoop2 i = 03 do4 i = i+15 write(*,*)"Beg<strong>in</strong> of a cycle!"67 ! for i=3 the cycle should not be executed8 if (i.eq.3) cycle910 ! break the entire loop for all i > 511 if (i.gt.5) exit1213 write(*,*)"i=",i1415 end do1617 write(*,*)"End of the loop!"18 end program GeneralLoopE. Baeck

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!