I was reading the erb section of Progamming Ruby this morning. WRT <
%, I note that they say, “Insert the given Ruby code at this point in
the generated program. If it outputs anything include this output in
The last sentence left me a bit confused. Surely I can’t do something
<% print(‘Hello, world!’) %>
I did some Googling and came across:
which seemed to say that’s exactly what I could do. However, of
course when I tried it, it didn’t work. That’s not too surprising to
me since it was always my understanding that ‘print’ directed output
to the console and not to standard out.
Anyway, can someone clear the confusion for me. If there is a way to
use ‘print’ as is suggested (or something similar), I’d sure like to
know about it as it would come in handy every once in a while.
Thanks for any input.