Visualg-assign to two variables in the same row

I would like to know how I put 1 variable next to the other in visualg?

Exemplo:

1.0  7.0
5.0  9.0

Since the 4 numbers are real variables, to simplify I want to write 1.0 down 5.0 ai the cursor goes up I write 7.0 and down 9.0

var

   X1, X2, Y1, Y2, R:REAL


inicio

      Leia(X1)
      Leia(X2)
      Leia(Y1)
      Leia(Y2)
      R <- raizq((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))//FORM CALCULAR DISTANCIA
      Escreval (R:1:4)



fimalgoritmo
Author: Luiz Augusto, 2019-03-17

1 answers

According to the Portugol language manual, the leia function allows the input of data, receiving the values entered by the user, assigning them to the declared variable along with the Leia function.

3.5.1 internal functions

As already seen in previous examples, G-Portugol offers two built-in functions: "read" and "print", which allow basic use of input and output, respectively. The "Read" function does not receive arguments and returns the standard input read value ("STDIN"), which it usually means to read the data that the user enters on the keyboard, followed by the "newline" character (usually associated with the "Enter" key" not keyboard) . The type of data returned by "Read" is implicitly converted to the primitive type required in the context in which it is used.

As quoted above, it is understood that the character 'new line' is that allows the value to be assigned to the respective variable. therefore there is no possibility to assign two values to two different variables in the same line, as we see in other languages - example: python.

Recalling the objectives of the Portugol language:

" on the other hand, subjecting a beginner to the rigors of a language of programming like Pascal or the" esotericism " of C is also exaggerated. We ideal would be a simpler language , Similar to "Portugol", of great popularity in the academic means and present in books more used; with it, the basic principles of structured programming they can be taught without the learning curve being steep."

I believe that due to the fact that" Portugol " aims to be a simple language for beginners there is no possibility of multiple assignment as in Python

Sources:

  1. Manual Portugol

  2. Manual Visualg tool

 2
Author: Luiz Augusto, 2019-03-17 02:03:27