From: "Stu P. D'naim" Date: 2013-02-16T03:17:07+09:00 Subject: Re: so, what's the proper way to replace funcionality of GOTO ? WILLS, JAMAL A wrote in post #1097138: > > def showMenu menuText > puts menuText > puts > print "What do you desire? " > > > menu_00 = %q{menu 00 > > 1 - open menu_01 > 2 - open menu_02 > 3 - open menu_03 > 4 - open menu_04 > q - Quit} > Firstly, I know what are Functions/Methods, but I find GOTO much easier to follow (and also more powrfull, because I can RETURN wherever I want - in GOSUB, and Functions, you always return to the point you started from) Secondly, this is great idea, to put entire menu in one long string. I wouldn't have thought of that !! Thanks ! I had idea (as described in original post at #2) to write code something like this: ------------------------------------------------ class Mymenus attr_acessor :over100variablesIintendtoUse def initialize #initialize every variable end def menu_00 #root menu system("cls") puts "Select something:" puts puts "1 - open menu_1" puts "2 - open menu_2" puts "3 - open menu_3" puts "4 - open menu_4" puts "q - Quit" end def menu_1 system("cls") puts "enter choice:" puts puts "1 - open menu_11" puts "2 - open menu_12" puts "3 - open menu_13" puts "4 - open menu_14" puts "b - Back" end def menu_2 system("cls") puts "enter choice:" puts puts "1 - open menu_21" puts "2 - open menu_22" puts "b - Back" end ... etc ... etc --------------------------------------------------------- ... and then probably put loop, starting with root menu, when you select number, you call new method (submenu) ... but your way seems easier, and with less methods involved -- Posted via http://www.ruby-forum.com/.