Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!bionet!agate!ucbvax!cs.washington.edu!wgg From: wgg@cs.washington.edu (William Griswold) Newsgroups: comp.lang.icon Subject: Re: Case statement and string scanning Message-ID: <9102251746.AA08120@june.cs.washington.edu> Date: 25 Feb 91 17:46:17 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 30 To handle more general test/action alternatives, I would put the tests and actions in procedures, store them in pairs in a list, and then iterate over the tests in the list until success: record pair(test,action) ... procedure bangmatch(str) return match("!",str) end ... procedure main(arglist) case_list := [pair(bangmatch,bangaction),....] ... if (pr := !case_list).test(string) then pr.action(string) ... end I'm sure there are more elegant solutions, but you get the idea. bill