# Using % for printng strings

**URL:** <https://rubytalk.org/t/using-for-printng-strings/68285>\
**Category:** ruby-talk\
**Created:** [4 August 2013 17:45 UTC](https://rubytalk.org/t/using-for-printng-strings/68285 "2013-08-04T17:45:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [4 August 2013 17:45 UTC](https://rubytalk.org/t/using-for-printng-strings/68285/1 "2013-08-04T17:45:24Z")

</div>

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

%{Here is number #{class InstantClass  
&nbsp;&nbsp;def bar  
&nbsp;&nbsp;&nbsp;"Some text"  
&nbsp;&nbsp;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?

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![stomar](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stomar](https://rubytalk.org/u/stomar)\
**Post date:** [4 August 2013 18:02 UTC](https://rubytalk.org/t/using-for-printng-strings/68285/2 "2013-08-04T18:02:04Z")

</div>

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

> **···**
>
> Am 04.08.2013 19:45, schrieb David Acosta:
> 
> > Hello comunity, I'm trying some code from ruby cookbook, and i have  
> > this:
> > 
> > %{Here is number #{class InstantClass  
> > &nbsp;&nbsp;def bar  
> > &nbsp;&nbsp;&nbsp;"Some text"  
> > &nbsp;&nbsp;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?
> 
> --  
> GitHub: [stomar (Marcus Stollsteimer) · GitHub](https://github.com/stomar/)  
> PGP: 0x6B3A101A
