J
John Merlino
Hey all, || is equal to Or. So what would ||= in this situation?
def expensive
@expensive ||=
begin
n = 99
buf = ""
begin
buf << "#{n} bottles of beer on the wall\n"
# ...
n -= 1
end while n > 0
buf << "no more bottles of beer"
end
end
Thanks for all suggestions. Also if you can interpret this, that would
be nice. What it appears here is an attempt of a do while loop.
def expensive
@expensive ||=
begin
n = 99
buf = ""
begin
buf << "#{n} bottles of beer on the wall\n"
# ...
n -= 1
end while n > 0
buf << "no more bottles of beer"
end
end
Thanks for all suggestions. Also if you can interpret this, that would
be nice. What it appears here is an attempt of a do while loop.