Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,992
    Thanks
    120
    Thanked 76 Times in 76 Posts

    missing } in compound statement ?

    what is that I don't see in the following function ? Where is } missing ? Thanks for help.

    Code:
    function test11()
    {
      var success = "false";
      var done = "false";
    
      while (success != "true")
      { 
        try
        {
          member.memberSignIn();
          success = "true";
        }
        catch(err)
        {
          if  (done != "true")
          {     
             memberGetJavaScript();
             done = "true";
          {   
        }
      }
    
    }
    Last edited by BubikolRamios; 09-23-2006 at 12:55 PM. Reason: wraping code tags around selected text, hopig for better identation

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Have you tried prettyprinting that? The error becomes apparent if you do:
    Code:
    function test11(){
        var
            success=false,
            done=false;
        while(!success){ 
            try{
                member.memberSignIn();
                success=true;
            }catch(err){
                if(!done){     
                    memberGetJavaScript();
                    done=true;
                    {}
                }
            }
    In other words, you've turned one closing brace into an opening brace, thus creating the block marked red here.


    Also why do you use 'true'/'false' strings instead of real booleans?
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    LinkBacks (?)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •