Ruby中有GOTO跳转语句吗?

如题。

有的话该如何写?
[b]问题补充:[/b]
但是我通过

[code="ruby]

因为 :here 提示说语法错误,我就放后面了

here:

....

goto here
[/code]

貌似又可以执行,不过会出现一些错误。

不知道这个语法是否正确啊,找了半天没找到。

block/Proc 只是执行一个固定的block.与goto相差深远。

http://www.ruby-doc.org/core/classes/Proc.html

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/72922

上面链接提及一个实现了Goto的第三方包。
不过有点难看。

貌似没有这么糟糕德东西.不过可以用block/proc轻松且优雅的实现......
自己查查吧,用手机回的,不能帖代码.....见谅

一般需要goto的话可以用Ruby的throw/catch来做。引用《The Ruby Programming Language》上的例子:
[code="ruby"]for matrix in data do # Process a deeply nested data structure.
catch :missing_data do # Label this statement so we can break out.
for row in matrix do
for value in row do
throw :missing_data unless value # Break out of two loops at once.
# Otherwise, do some actual data processing here.
end
end
end
# We end up here after the nested loops finish processing each matrix.
# We also get here if :missing_data is thrown.
end[/code]
注意Ruby里处理异常的语句是raise/rescue而不是throw/catch。

[b]goto[/b]不是Ruby关键字也不是内建方法……