3

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'"

Drew
  • 75,699
  • 9
  • 109
  • 225
Julie Dupondt
  • 31
  • 1
  • 2

1 Answers1

6

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).

Drew
  • 75,699
  • 9
  • 109
  • 225