Return to Snippet

Revision: 5550
at March 14, 2008 19:31 by cczona


Initial Code
print <<EOF
The price is #{$Price}.
EOF

print <<"EOF";			# same as above
The price is #{$Price}.
EOF

print <<`EOC`			# execute commands
echo hi there
echo lo there
EOC

print <<"foo", <<"bar"	# you can stack them
I said foo.
foo
I said bar.
bar

myfunc(<<"THIS", 23, <<'THAT')
Here's a line
or two.
THIS
and here's another.
THAT

if need_define_foo
eval <<-EOS			# delimiters can be indented
              def foo
                print "foo\n"
	      end
EOS
end

Initial URL
http://www.ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/syntax.html

Initial Description
Following a

Initial Title
Ruby heredoc tricks

Initial Tags
ruby

Initial Language
Ruby