| Posted by Neredbojias on 09/30/05 16:58 
With neither quill nor qualm, Spartanicus quothed:
 > How should functions be invoked conditionally from within a function?
 > This throws errors and doesn't work:
 >
 > function test() {
 >    if (0 == 0)
 >       {
 >          function foo();
 >       }
 >       if (1 == 1)
 >       {
 >          function bar();
 >       }
 > }
 >
 > Minimized test case: http://homepage.ntlworld.com/spartanicus/temp.htm
 
 You've basically got it right.
 
 function test() {
 if (a) {
 foo();
 } else {
 if (b) bar();
 }
 }
 
 --
 Neredbojias
 Contrary to popular belief, it is believable.
 [Back to original message] |