# Creation string depends of variables

**URL:** <https://www.ruby-forum.com/t/creation-string-depends-of-variables/123502>\
**Category:** Ruby\
**Created:** [December 18, 2007, 9:17am UTC](https://www.ruby-forum.com/t/creation-string-depends-of-variables/123502 "2007-12-18T09:17:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![enjo20](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c37758/32.png) [@enjo20](https://www.ruby-forum.com/u/enjo20)\
**Post date:** [December 18, 2007, 9:17am UTC](https://www.ruby-forum.com/t/creation-string-depends-of-variables/123502/1 "2007-12-18T09:17:17Z")

</div>

I wanna create a full string depends on some variables.

let me give example.

def sayOddOrNot(aNum)  
sFullStr = \<\< END\_OF\_FULL\_STR  
the num is SOMETHING(ODD OR NOT)  
END\_FULL\_STR  
end

how can I complete a full string depends of aNum variable in a string?

---

<div class="post-metadata">

**Author:** ![enjo20](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c37758/32.png) [@enjo20](https://www.ruby-forum.com/u/enjo20)\
**Post date:** [December 18, 2007, 12:51pm UTC](https://www.ruby-forum.com/t/creation-string-depends-of-variables/123502/2 "2007-12-18T12:51:40Z")

</div>

junyoung kim wrote:

> I wanna create a full string depends on some variables.
> 
> let me give example.
> 
> def sayOddOrNot(aNum)  
> sFullStr = \<\< END\_OF\_FULL\_STR  
> the num is SOMETHING(ODD OR NOT)  
> END\_FULL\_STR  
> end
> 
> how can I complete a full string depends of aNum variable in a string?

def sayOddOrNot(aNum)  
sFullStr = \<\< END\_OF\_FULL\_STR  
the num is #{SOMETHING(ODD OR NOT)}  
#{aNum}  
#{aNum == 5 ? ‘Yes’ : ‘No’}  
END\_FULL\_STR  
end

If I understood it right.

by  
TheR
