|
From: Rob <ro...@us...> - 2002-07-02 12:07:30
|
I think I'd rather write a function, even a one-liner and call it than use GOTO. Rob http://uselesspython.com original message: ----------------------------------------------------------------------- Teodorescu Cristian wrote: Ioannis Vranos wrote: <snip /> Bad and good Bad becuse they called goto. Good beacuse it help you to define a way a good one in a switch sometimes i have to write smth like switch (x){ case 1 : code_1 ;break case 2 : code_2 ;break case 3 : code3+code 1:break case 4 : code 4+code 2:break default : break; }; so in C# : switch (x){ case 1 :code_1; case 2 : code_2; case 3 : code 3 goto 1; case 4 : code_4 goto 2; }; more simple [:-)] It was something like: switch(x) { case 1: x=2; goto 3; case 3: y=4; case 5: z=6; default: // something } As i said something *like* that. So if you want to do the same job for some range of values you have to use gotos! e.g. in C++ you would do: switch(x) { case 1: case 2: case 3: cout<<"Get lost loser!\n"; break; // ... } in C# you have to do sonething like: switch(x) { case 1: goto case 3; case 2: goto case 3; case 3: something_java_like.writeconsole_something("Get lost loser!\n"); // ... } Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users -- "Giving the Linus Torvalds Award to the Free Software Foundation is a bit like giving the Han Solo Award to the Rebel Alliance." --Richard Stallman at the 1999 LinuxWorld show |