source-academy/js-slang

print: display string in REPL without quotation marks

Opened this issue · 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.

obsolete:

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

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" : ""))