Thanks Matthew and Stu for the reply.

I noticed my what you mentioned. ',' with the puts statement was the 
culprit.

Thanks for helping me to understand and learn!

Have a nice day ahead!

-Kaustubh


Matthew Kerwin wrote in post #1135898:
> Kaustubh Chaudhari wrote in post #1135891:
>> Hi All,
>>
>> Sorry if i am bothering you all with a silly question. I am new to
>> programming itself not just to ruby.
>>
>> print "what is your age? "
>> age = gets.chomp()
>> puts "So you are %s years old.", %age
>>
>> This is not working as expected. It is erroring out  "unterminated
>> string
>> meets end of file"
>
> If we look at your last line, and remove the syntax sugar, we get one of
> these:
>
>   puts("So you are %s years old.", %age)
>   puts("So you are %s years old.",).%(age)
>
> The first one is invalid because `%age` by itself doesn't make sense,
> and the second one is bad because you have a trailing comma in the list
> of parameters to `puts`.
>
> I suspect what you meant was:
>
>   puts("So you are %s years old.".%(age))
>   # or with some sugar:
>   puts "So you are %s years old." % age
>
> Note that `%` is a method on the String class.

-- 
Posted via http://www.ruby-forum.com/.