cx icon indicating copy to clipboard operation
cx copied to clipboard

`read()` is not working.

Open amherag opened this issue 5 years ago • 1 comments

Describe the bug If you use read() to ask for user input and try to print the result, an empty string is printed.

To Reproduce Steps to reproduce the behavior:

  1. Write this code to test.cx:
package main

func main() {
  str.print(read())
}
  1. Run the program with cx test.cx
  2. Write an arbitrary string to be read by CX.
  3. An empty string is printed.

Expected behavior Print the string that was captured by the user to standard output.

Desktop (please complete the following information):

  • OS: [e.g. Linux, Windows]
  • Browser (if related to cx.skycoin.net) [e.g. Chrome, Safari]
  • CX Version 0.7.1

amherag avatar Oct 23 '19 02:10 amherag

read-string.cx from examples doesn't run correctly.

read() allows user input, but unable to initialize variable with it like in following case:

var name str
str.print("What's your name?")
name = read()
printf("Hello, %s!\n", name)

This fails to print name, because name has no value after read().

Operating system: Windows Version of CX: 0.8.0

archerixx avatar Mar 22 '21 17:03 archerixx