Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #7456

Re: question regarding syntax of #{rand()}

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 <rtdo5hlbh8jm2aglnk630j5qm4kejdcnoo@4ax.com>
Injection-Info google-groups.googlegroups.com; posting-host=23.158.144.116; posting-account=VCBxdQoAAABx_tZKaqKNNcyjDzVW5bon
NNTP-Posting-Host 23.158.144.116
References <o8cl5h12k365eosq8aro47si1reckooud6@4ax.com> <210rii-cgn.ln1@tempo.martinkl.dialup.fu-berlin.de> <rtdo5hlbh8jm2aglnk630j5qm4kejdcnoo@4ax.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <f825f49b-52c2-4d39-9d5e-e470d84bd018n@googlegroups.com> (permalink)
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

Show key headers only | View raw


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 
> <usenet.martinkl@gmx.de> wrote: 
> 
> >Here it works when using double-quotes instead of single: 
> > 
> >| puts "Did #{@damage} damage!" 
> > 
> >Proof: 
> > 
> >| martinkl@maurice:~/src/eigene/ruby$ ./guard_dog.rb 
> >| Did 0 damage! 
> >| martinkl@maurice:~/src/eigene/ruby$ ./guard_dog.rb 
> >| Did 6 damage! 
> >| martinkl@maurice:~/src/eigene/ruby$ ./guard_dog.rb 
> >| Did 2 damage! 
> >| martinkl@maurice:~/src/eigene/ruby$
> Ah, I see; according to p. 35 of the book, 
> 
> > Well, the #{} magic (called string interpolation if you 
> > want to be super fancy) is possible only with 
> > double-quoted strings; it can’t be done with 
> > single-quoted ones. 
> 
> Apparently, I had better either differentiate more closely between 
> single and double quotes when reading the book, or increase my intake 
> of ginkgo biloba (which I have been too stingy to take recently) to 
> increase my memory. 
> 
> Thank you for your response; issue resolved.
> -- 
> Benjamin L. Russell / DekuDekuplex at Yahoo dot com 
> http://dekudekuplex.wordpress.com/ 
> Computer Science Document Proofreader/Editor 
> "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^
IDK what who you are

Back to comp.lang.ruby | Previous | NextPrevious in thread | Find similar


Thread

question regarding syntax of #{rand()} Benjamin L. Russell <DekuDekuplex@Yahoo.com> - 2022-04-16 21:16 +0900
  Re: question regarding syntax of #{rand()} Martin Klaiber <usenet.martinkl@gmx.de> - 2022-04-16 16:21 +0200
    Re: question regarding syntax of #{rand()} Benjamin L. Russell <DekuDekuplex@Yahoo.com> - 2022-04-18 00:58 +0900
      Re: question regarding syntax of #{rand()} Sophia Ding <2027dings78@moundsviewschools.org> - 2022-05-10 09:44 -0700

csiph-web