Vladimir K. wrote in post #1136072:
people, WTF?
Good day to you too, malchik.
if i use variable say “customer” and then use “customer” in subloop i’ll
be fucked up.
Wow, that sounds a bit extreme. I’ve never had that happen to me because
I made a mistake in a computer program. What looping constructs have
you misused in such a way? For example, here’s one that doesn’t have
any painful repercussions:
def foo *args
var = 1 # <-- local variable
args.each do |arg| # <-- loop
3.times do |i| # <-- subloop
var = (var + i) * arg
# <-- using variable in subloop
end
end
p var
end
foo 1, 2, 3 #=> 1281
is it so difficult to enable local variables, i cant
believe.
You keep using that term. I do not think it means what you think it
means.
def bar
b = 1 # <-- local variable
b
end
bar #=> 1
def baz
c = 1 # <-- local variable
lambda{|x| c = c + x } # <-- … used in a closure
end
baz[2] #=> 3
you now playing worse than bad-minded PHP.
Naughty, naughty bad PHP. You must spank her!
Out of interest, do you come from a javascript background?
thank you, if you delete this topic i’ll recreate it
You’re welcome. Why do you think we’d do that? Do you suspect that
some of your wording may have been unconstructive or offensive? Do you,
in fact, believe that your post was so offensive that we would
completely remove it from the forum? I only ask because you brought it
up; although I do have one question: why post something that you suspect
will be deleted, and even include in said post a description of what
would happen in the event of deletion, when you could instead alter the
post to be less offensive, and possibly even include some description of
your problem in a way that allows the great minds and friendly people in
this forum to offer you some constructive help/sympathy/etc.?