Running a function, for example:

(print '"Hello World")

"Hello World" "Hello World"

... outputs twice the expected result.

I suppose one is the real printing, and the second is the value returned. However, I still want an alternative to this.

What is the equivalent of the Python python -c "print 'Hello World'"

  • 2
    (message "Hello World") – choroba Nov 22 '15 at 0:05

You see both:

  1. The behavior of the print function - a side effect.

  2. The return value of that function.

This is because of the way you evaluated the expression, interactively. If you used something like M-: to evaluate it, that command prints (echoes) the return value of the evaluated expression, independently of what the function itself might do (which in this case is to print the same thing as the return value).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.