You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
program Chars begin
main |[
var x : char
; write("First try: ")
; read(x)
; writeln("Your input: ", x)
; write("Second try: ")
; read(x)
; writeln("Your input: ", x)
; write("Third try: ")
; read(x)
; writeln("Your input: ", x)
]|
end
If any input is consistent of a blank line (pressing the "Enter"/Return key) and then any other character (which is parsed as a single input), or an empty space (' ') any following read char will be parsed as a blank line, no matter the input. For example, on the following run, my inputs are "1", "2", "3" in order. This is the output:
aitorres@fibonacci:~$ rungraciela chars.gcl
First try:
1
Your input:
Second try: 2
Your input:
Third try: 3
Your input:
It still does not work even if I change variables. Consider the following program:
program Chars2 begin
main |[
var x, y, z : char
; write("First try: ")
; read(x)
; writeln("Your input: ", x)
; write("Second try: ")
; read(y)
; writeln("Your input: ", y)
; write("Third try: ")
; read(z)
; writeln("Your input: ", z)
]|
end
With the same input as before, the output is:
aitorres@fibonacci:~$ rungraciela chars2.gcl
First try:
1
Your input:
Second try: 2
Your input:
Third try: 3
Your input:
Any combination of inputs with no blank lines () or spaces before works as expected.
Note that this error makes it difficult to deal with player input for the Minesweeper project of CI-2691 (Universidad Simón Bolívar) for this term.
The text was updated successfully, but these errors were encountered:
After doing some tests, this error happens after more than one char is tried to be inputed at a char input. For example, in any of the previous example programs, inputing "22" or " 2" or "a8" or any combination of two or more characters will accept the input, parse it in a certain way (given by the first char) and then any following input will not be read, defaulting to a blank line/space.
Consider the following program:
If any input is consistent of a blank line (pressing the "Enter"/Return key) and then any other character (which is parsed as a single input), or an empty space (' ') any following read char will be parsed as a blank line, no matter the input. For example, on the following run, my inputs are "1", "2", "3" in order. This is the output:
It still does not work even if I change variables. Consider the following program:
With the same input as before, the output is:
Any combination of inputs with no blank lines () or spaces before works as expected.
Note that this error makes it difficult to deal with player input for the Minesweeper project of CI-2691 (Universidad Simón Bolívar) for this term.
The text was updated successfully, but these errors were encountered: