End repeat loop Repeat Visualg

1

When we use repita together with ate at the end of the block, should we also use fimrepita ? If not, when do we use this?

algoritmo "semnome"
var
   t,n,i,m:inteiro
inicio
   i<-0
   repita
      escreval ("entre com a nota")
      leia (N)
      escreval ("entre com a nota")
      leia (M)
      t<-(n+m)
      escreval ("a media do aluno foi:",t)
      i<-i+1
   ate i=5
fimalgoritmo
    
asked by anonymous 06.07.2018 / 18:28

1 answer

2

fimrepita is used when there is no default stop condition, such as ate . That is, when it repeats until a stop condition occurs, as below:

var x: inteiro
x <- 0
repita
    x <- x + 1
    se x = 10 entao
        interrompa
fimrepita

It serves to define how far the code block of your command will repeat. But when you use the ate command, you do not need to use fimrepita .

Reference

06.07.2018 / 18:40