Double printing of text when using System.print or System.write in REPL
iddev5 opened this issue · 1 comments
Any text printed using System.print or System.write is displayed twice. It is happening only for REPL and not in file mode(even when the file contains only a single print statement)
When System.print is used with an if(true)
statement, it is printed only once but the same condition causes System.write to not print anything at all.
When you call System.print
or System.write
, wren prints the value passed to that function and then returns the values as a string. In the screenshot below, wren takes the System.print
and prints whats inside, then prints what that function returns. If you look closely, the color of Hello world
should be slightly different to differentiate a printed value and a returned value.
In the next screenshot, you can see that wren can set the value of variables to whatever System.print
returns and then print that value later.
In the next screenshot, if(true)
doesn't actually return anything so System.print
just prints the value and returns nothing thus printing once. Variables also don't return values so x
doesn't actually return anything