داکیومنت های " Here " به رشته هایی اشاره میکند که از چند خط تشکیل شده اند . در این حالت پس از عبارت >> می توان شناسه ای را مشخص کرد که رشته با آن پایان می یابد
اگر شناسه داخل نقل قول یا کوتیشن قرار گرفته باشد نوع کوتیشن ، نوع رشته های بعدی را مشخص میکند .
در اینجا ، مثال های مختلفی بیان شده است
#!/usr/bin/ruby -w
print <<EOF
This is the first way of creating
here document ie. multiple line string.
EOF
print <<"EOF"; # same as above
This is the second way of creating
here document ie. multiple line string.
EOF
print <<`EOC` # execute commands
echo hi there
echo lo there
EOC
print <<"foo", <<"bar" # you can stackthem
I said foo.
foo
I said bar.
bar
که این خروجی زیر را تولید خواهد کرد .
This is the first way of creating
her document ie. multiple line string.
This is the second way of creating
her document ie. multiple line string.
hi there
lo there
I said foo.
I said bar.
اگر شناسه داخل نقل قول یا کوتیشن قرار گرفته باشد نوع کوتیشن ، نوع رشته های بعدی را مشخص میکند .
در اینجا ، مثال های مختلفی بیان شده است
#!/usr/bin/ruby -w
print <<EOF
This is the first way of creating
here document ie. multiple line string.
EOF
print <<"EOF"; # same as above
This is the second way of creating
here document ie. multiple line string.
EOF
print <<`EOC` # execute commands
echo hi there
echo lo there
EOC
print <<"foo", <<"bar" # you can stackthem
I said foo.
foo
I said bar.
bar
که این خروجی زیر را تولید خواهد کرد .
This is the first way of creating
her document ie. multiple line string.
This is the second way of creating
her document ie. multiple line string.
hi there
lo there
I said foo.
I said bar.