This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

breaking out of a switch and running more code

Old posts that have not been replied to for several years.
Locked
D
Dw2k
Voice
Posts: 16
Joined: Sat Dec 07, 2002 4:40 pm
Location: Dundee || Liverpool
Contact:

breaking out of a switch and running more code

Post by Dw2k »

Im trying to figure out how to come out of a switch and run more code, e.g.

Code: Select all


proc {lalala} {
set up args
do somecode here

switch $something {
 "somearg" {
        dosomecode
        return / break
 }
 "someotherarg" {
        dosomeothercode
        return / break
  }
 }

do more code here (outside of switch)
}

I have tried using return and break, to no avail. Can anyone point me to the right direction? :D
Dave
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

You don't break out of a switch statement.. it's not a loop.... you just do your branches, and then outside of the switch clause, you add your code. Simple as that.
D
Dw2k
Voice
Posts: 16
Joined: Sat Dec 07, 2002 4:40 pm
Location: Dundee || Liverpool
Contact:

Post by Dw2k »

Hmm, thats what I assumed at the start.

I must have something else wrong in my code, i'll have another look.

Thanks :)

EDIT: Yes, my fault. I was rehashing the bots each time, a restart made them recognise the new code. Strange one that.
Dave
Locked