Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Instructiuni care descriu structurile de control
- 1. Structura alternativa
- a) Decizia
- IF conditie [THEN]
- secventa1
- [ELSE]
- secventa2
- ENDIF
- b) Selectia
- DO CASE
- CASE cond1
- secventa1
- CASE cond2
- secventa2
- ...
- CASE cond_n
- secventa_n
- [OTHERWISE]
- [secventa0]
- ENDCASE
- 2. Structuri repetitive
- DO WHILE cond
- secventa
- ENDDO
- In cadrul secventei pot sa apara comenzile LOOP, respectiv EXIT
- LOOP - intrerupe executia buclei si reia conditia din DO WHILE
- EXIT - intrerupe executia buclei si trece la executia urmatoarei comenzi de dupa ENDDO
- FOR contor=Vi TO Vf [STEP pas]
- secventa
- [LOOP][EXIT]
- ENDFOR
- Obs.: In cazul in care nu se precizeaza valoarea pasului, valoarea sa implicita este 1
- FOR i=1 TO RECCOUNT()
- GO i
- DISP <=> LIST
- ENDFOR
- Comanda SCAN permite parcurgerea tabelei curente element cu element
- SCAN [domeniu][FOR cond]
- secventa
- [LOOP][EXIT]
- ENDSCAN
- Ex: Sa se determine media maxima a elevilor cu varsta de 16 ani.
- SCAN FOR varsta=16
- IF media>max
- max=media
- ENDIF
- ENDSCAN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement