一般需要goto的话可以用Ruby的throw/catch来做。。。不过。。。RGSSMS没这东西。。。
引用《The Ruby Programming Language》上的例子:
[pre lang="ruby" line="1"]
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 [/pre]
goto不是Ruby关键字也不是内建方法……