# Meaning of @variable@?

**URL:** <https://www.ruby-forum.com/t/meaning-of-variable/222118>\
**Category:** Ruby\
**Created:** [August 13, 2012, 12:41pm UTC](https://www.ruby-forum.com/t/meaning-of-variable/222118 "2012-08-13T12:41:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 13, 2012, 12:41pm UTC](https://www.ruby-forum.com/t/meaning-of-variable/222118/1 "2012-08-13T12:41:28Z")

</div>

what is the meaning of the following instruction  
aaa.gsub!(’@variable@’, current)

---

<div class="post-metadata">

**Author:** ![proggrammer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/47e85d/32.png) [@proggrammer](https://www.ruby-forum.com/u/proggrammer)\
**Post date:** [August 13, 2012, 12:49pm UTC](https://www.ruby-forum.com/t/meaning-of-variable/222118/2 "2012-08-13T12:49:41Z")

</div>

Because it’s a string, and in single quotes, surely it would be taken  
literally and any instance of @vraiable@ in aaa would be replaced with  
whatever is in the current variable

Yule;

---

<div class="post-metadata">

**Author:** ![proggrammer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/47e85d/32.png) [@proggrammer](https://www.ruby-forum.com/u/proggrammer)\
**Post date:** [August 13, 2012, 12:56pm UTC](https://www.ruby-forum.com/t/meaning-of-variable/222118/3 "2012-08-13T12:56:38Z")

</div>

Paul B. wrote in post #1072189:

> Because it’s a string, and in single quotes, surely it would be taken  
> literally and any instance of @vraiable@ in aaa would be replaced with  
> whatever is in the current variable
> 
> Yule;

what is that ‘@’ in both ends?

---

<div class="post-metadata">

**Author:** ![proggrammer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/47e85d/32.png) [@proggrammer](https://www.ruby-forum.com/u/proggrammer)\
**Post date:** [August 13, 2012, 1:12pm UTC](https://www.ruby-forum.com/t/meaning-of-variable/222118/4 "2012-08-13T13:12:29Z")

</div>

Paul B. wrote in post #1072189:

> Because it’s a string, and in single quotes, surely it would be taken  
> literally and any instance of @vraiable@ in aaa would be replaced with  
> whatever is in the current variable
> 
> Yule;

what is that ‘@’ in both ends?

Just that, an @ character. So  
aaa = ‘This is a string @variable@ blah blah blah’  
current = ‘XXXX  
aaa.gsub!(’@variable@', current)  
aaa  
==\> ‘This is a string XXXX blah blah blah’

---

<div class="post-metadata">

**Author:** ![proggrammer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/47e85d/32.png) [@proggrammer](https://www.ruby-forum.com/u/proggrammer)\
**Post date:** [August 13, 2012, 4:20pm UTC](https://www.ruby-forum.com/t/meaning-of-variable/222118/5 "2012-08-13T16:20:06Z")

</div>

On Mon, Aug 13, 2012 at 6:10 AM, Paul B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Just that, an @ character. So  
> aaa = ‘This is a string @variable@ blah blah blah’  
> current = ‘XXXX  
> aaa.gsub!(’@variable@', current)  
> aaa  
> ==\> ‘This is a string XXXX blah blah blah’

To expand on this – probably @ has some meaning like “the enclosed  
string should be replaced with a value” in whatever program Ajay is  
working with. But it doesn’t mean anything to Ruby itself.

---

<div class="post-metadata">

**Author:** ![proggrammer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/47e85d/32.png) [@proggrammer](https://www.ruby-forum.com/u/proggrammer)\
**Post date:** [August 13, 2012, 1:10pm UTC](https://www.ruby-forum.com/t/meaning-of-variable/222118/6 "2012-08-13T13:10:44Z")

</div>

‘@’ at both ends is just a part of the string, nothing special about it.

Regards,  
Krishna A…
