For future passengers, :results value
(the default option) requires an explicit return
statement to display its value. On the other hand, :results output
displays everything from the standard output.
Examples
In both cases, 1+2
is not enough.
#+begin_src js :results value
return 1 + 2;
#+end_src
#+RESULTS:
: 3
#+begin_src js :results output
console.log(1 + 2);
#+end_src
#+RESULTS:
: 3
‘value’
Default for most Babel libraries. Functional mode. Org gets the value by wrapping the code in a function definition in the language of the source block. That is why when using ‘:results value’, code should execute like a function and return a value. For languages like Python, an explicit return statement is mandatory when using ‘:results value’. Result is the value returned by the last statement in the code block.
...
‘output’
Scripting mode. Org passes the code to an external process running the interpreter. Org returns the contents of the standard output stream as text results.
...