Portugol has ternary operator?

Asked

Viewed 586 times

7

Portugol has some ternary operator?

Example of how it works in several languages:

algumaVar = 10 > 0 ? 8 : 4

Just out of curiosity, it would be interesting if you had.

  • 2

    I believe that it does not exist and, in my opinion, it does not even make sense to exist. Although the ternary operator is useful, the idea of portugol is the teaching of algorithms for beginners. In this way, it always gives preference to the explicit and readable, approaching the natural language of the person. The.

2 answers

11


Has not.

I reviewed Visualg’s references and there’s no talk of ternary operators.

It’s a little matter of opinion, but I think it makes sense, since Portuguese is only used for didactic purposes, so it needs to be readable and compressible and the more explicit, the better to read.

1

To affirm the non-existence of something it is necessary to be a deep connoisseur of the subject, which is not my case. But already many materials about Portugol, some seemed to me very complete, and never seen anything like.

It makes sense because this operator is a commodity and in a language of learning it makes no sense to have something like this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.