For your program to work this way it has to be by conditional structure se
:
escreval("Digite o consumo")
leia(consumo)
se consumo <= 100 e consumo>=0 entao
escreval("Parabéns, voce e economico")
fimse
se consumo>=101 e consumo<200 entao
escreval("Cuidado com o consumo")
fimse
se consumo >=200 entao
escreval("Consumo execessivo")
fimse
se consumo <0 entao
escreval("Valor invalido")
fimse
If you choose to escolha/caso
you have to remember that this kind of structure is like switch/case
in other languages. You must have a number or character set in order to make the case. Example case 105 ... case 200... (pre-defines the numbers that may be the ones to access the case) in the example you gave is like a comparison, if consumption is <100 do ...(Remembering that <100 would have multiple "numbers" so can not be used escolha/caso
)
You can’t. The structure of
escolha/caso
will check whetherconsumo
is equal to the value defined in each case. Basically you would be comparingconsumo = <= 100
, which makes no sense.– Woss
So I can only have one set value for the "case"?
– João Victor Trindade
@Joãovictortrindade tries to see the answer down there to see if I can help you...
– Maurício Z.B