# Using % for printng strings

**URL:** <https://www.ruby-forum.com/t/using-for-printng-strings/236083>\
**Category:** Ruby\
**Created:** [August 4, 2013, 7:45pm UTC](https://www.ruby-forum.com/t/using-for-printng-strings/236083 "2013-08-04T19:45:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [August 4, 2013, 7:45pm UTC](https://www.ruby-forum.com/t/using-for-printng-strings/236083/1 "2013-08-04T19:45:22Z")

</div>

Hello comunity, I’m trying some code from ruby cookbook, and i have  
this:

%{Here is number #{class InstantClass  
def bar  
“Some text”  
end  
end  
InstantClass.new.bar  
}.}

It is supposed to print me “Here is Some text” but, it doesn’t bring me  
anything.

What can i do in this case o what could be the reason why it doesn’t  
show anything?

---

<div class="post-metadata">

**Author:** ![mickey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ccd318/32.png) [@mickey](https://www.ruby-forum.com/u/mickey)\
**Post date:** [August 4, 2013, 8:03pm UTC](https://www.ruby-forum.com/t/using-for-printng-strings/236083/2 "2013-08-04T20:03:17Z")

</div>

Am 04.08.2013 19:45, schrieb David A.:

> It is supposed to print me “Here is Some text” but, it doesn’t bring me  
> anything.
> 
> What can i do in this case o what could be the reason why it doesn’t  
> show anything?

You do not do anything with the string.

Use `puts %{…}’ to output the string to screen or enter  
it into irb (which by default outputs the value of all  
entered expressions)

Regards,  
Marcus
