js-slang icon indicating copy to clipboard operation
js-slang copied to clipboard

print: display string in REPL without quotation marks

Open martin-henz opened this issue 10 months ago • 2 comments

Currently

display(1.5, "abc")

prints:

abc 1.5

and

display("cde", abc")

prints:

abc: "cde"

This works quite well, with the exception that sometimes, I want to display a (possibly multi-line) string without quotation marks, and without a value coming after it. I propose that we introduce print(string):

print("**********************************************\n*** the program entered the main algorithm ***"\n*********************************************")

should just display

**********************************************
*** the program entered the main algorithm ***
**********************************************

without quotation marks.

martin-henz avatar Apr 10 '24 08:04 martin-henz

obsolete:

What happens if we want to display the actual value undefined?

RichDom2185 avatar Apr 10 '24 08:04 RichDom2185

obsolete:

What happens if we want to display the actual value undefined?

A small hack would be needed:

display(value, "the value is:" + (is_undefined(value) ? " undefined" : ""))

martin-henz avatar Apr 10 '24 08:04 martin-henz