X-Received: by 2002:a05:620a:248c:b0:6a0:54f8:9077 with SMTP id i12-20020a05620a248c00b006a054f89077mr11924858qkn.500.1652201060890; Tue, 10 May 2022 09:44:20 -0700 (PDT) X-Received: by 2002:ad4:4b0a:0:b0:456:390f:6fb1 with SMTP id r10-20020ad44b0a000000b00456390f6fb1mr19000032qvw.32.1652201060646; Tue, 10 May 2022 09:44:20 -0700 (PDT) Path: csiph.com!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ruby Date: Tue, 10 May 2022 09:44:20 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=23.158.144.116; posting-account=VCBxdQoAAABx_tZKaqKNNcyjDzVW5bon NNTP-Posting-Host: 23.158.144.116 References: <210rii-cgn.ln1@tempo.martinkl.dialup.fu-berlin.de> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: question regarding syntax of #{rand()} From: Sophia Ding <2027dings78@moundsviewschools.org> Injection-Date: Tue, 10 May 2022 16:44:20 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2695 Xref: csiph.com comp.lang.ruby:7456 On Sunday, April 17, 2022 at 10:58:58 AM UTC-5, Benjamin L. Russell wrote: > On Sat, 16 Apr 2022 16:21:56 +0200, Martin Klaiber=20 > wrote:=20 >=20 > >Here it works when using double-quotes instead of single:=20 > >=20 > >| puts "Did #{@damage} damage!"=20 > >=20 > >Proof:=20 > >=20 > >| martinkl@maurice:~/src/eigene/ruby$ ./guard_dog.rb=20 > >| Did 0 damage!=20 > >| martinkl@maurice:~/src/eigene/ruby$ ./guard_dog.rb=20 > >| Did 6 damage!=20 > >| martinkl@maurice:~/src/eigene/ruby$ ./guard_dog.rb=20 > >| Did 2 damage!=20 > >| martinkl@maurice:~/src/eigene/ruby$ > Ah, I see; according to p. 35 of the book,=20 >=20 > > Well, the #{} magic (called string interpolation if you=20 > > want to be super fancy) is possible only with=20 > > double-quoted strings; it can=E2=80=99t be done with=20 > > single-quoted ones.=20 >=20 > Apparently, I had better either differentiate more closely between=20 > single and double quotes when reading the book, or increase my intake=20 > of ginkgo biloba (which I have been too stingy to take recently) to=20 > increase my memory.=20 >=20 > Thank you for your response; issue resolved. > --=20 > Benjamin L. Russell / DekuDekuplex at Yahoo dot com=20 > http://dekudekuplex.wordpress.com/=20 > Computer Science Document Proofreader/Editor=20 > "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ IDK what who you are