[#863] RDtool-0.5.0 — Toshiro Kuwabara <toshirok@...3.so-net.ne.jp>
Hi,
18 messages
1999/10/23
[#864] Re: RDtool-0.5.0
— matz@... (Yukihiro Matsumoto)
1999/10/26
Hi,
[#865] Re: RDtool-0.5.0
— Toshiro Kuwabara <toshirok@...3.so-net.ne.jp>
1999/10/26
Hi,
[#866] Re: RDtool-0.5.0
— matz@... (Yukihiro Matsumoto)
1999/10/26
Hi,
[#892] Re: RDtool-0.5.0
— Toshiro Kuwabara <toshirok@...3.so-net.ne.jp>
1999/10/31
Hi,
[#894] Re: RDtool-0.5.0
— matz@... (Yukihiro Matsumoto)
1999/11/01
Hi,
[#905] Re: RDtool-0.5.0
— Toshiro Kuwabara <toshirok@...3.so-net.ne.jp>
1999/11/04
Hi,
[#906] Re: RDtool-0.5.0
— matz@... (Yukihiro Matsumoto)
1999/11/04
Hi,
[#907] Re: RDtool-0.5.0
— Kazuhiro HIWADA <hiwada@...>
1999/11/04
Hi,
[#908] Re: RDtool-0.5.0
— kjana@... (YANAGAWA Kazuhisa)
1999/11/05
In message <19991105025532K.hiwada@kuee.kyoto-u.ac.jp>
[#867] call with a Proc — ts <decoux@...>
11 messages
1999/10/28
[#868] Re: call with a Proc
— gotoken@... (GOTO Kentaro)
1999/10/28
Hi,
[#877] local / dynamic variables — ts <decoux@...>
11 messages
1999/10/29
[#878] Re: local / dynamic variables
— gotoken@... (GOTO Kentaro)
1999/10/29
Hi,
[ruby-talk:00886] Re: local / dynamic variables
From:
gotoken@... (GOTO Kentaro)
Date:
1999-10-30 10:47:26 UTC
List:
ruby-talk #886
Hi,
In message "[ruby-talk:00885] Re: local / dynamic variables"
on 99/10/30, ts <decoux@moulon.inra.fr> writes:
>G> a = [4,5,6,3]
>G> sum = 0
>G> a.each{|i| sum += i}
>G> p sum
>
> Well it's not really a use of this feature, because sum is not defined
>between | |. Only i is between | | and in this case :
> * sum is a local variable
> * i is a dynamic variable
Oops! I'm sorry for showing wrong example :-(
Well, I try making another:
#
# find the first line matching a pattern and report with its line
#
lines = %w(foo bar baz quux).join("\n") # input data
w, i = nil, lines.size + 1 # sentinels
(lines + "\n").each_with_index{|w,i| break if /z/ =~ w}
unless i > lines.size
puts "z found at line #{i+1} (#{w.chomp!})"
else
puts "no such line"
end
By the way, those variables can be distinguished:
i = 0; [1].each{|i| p defined?(i)} #=> "local-variable"
[1].each{|i| p defined?(i)} #=> "local-variable(in-block)"
-- gotoken