How to rediect from a function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shiniskumar
    New Member
    • Feb 2007
    • 58

    How to rediect from a function

    ive got a method

    private void getAllChildsCor rToParent(Integ er parentId,Intege r compId,String name){

    for(){
    //-------
    }
    if{
    for(){
    getAllChildsCor rToParent(paren tId,compId,name );
    //----
    }
    }
    for(){
    //----
    }

    stmnts;
    }

    my problem is tat after executing the last statements , the control passes to the function inside the for loop. i want to exit from the whole method and go to the method from where getAllChildsCor rToParent() was called. how do i do this.
  • DeMan
    Top Contributor
    • Nov 2006
    • 1799

    #2
    let's see if putting code tags aroudn might shed some light on the problem
    Code:
    private void getAllChildsCorrToParent(Integer parentId,Integer compId,String name){
    
      for(){
        //-------
      }
      if{
        for(){
          getAllChildsCorrToParent(parentId,compId,name);
          //----
        }
      }
      for(){
        //----
      }
      stmnts;
    }
    a) is stmnts DEFINITELY executing?
    b) how do you know that it then revert s back into a for (and do you know which one)
    c) using the word "return" (with no return value) should return from a void function, however we should return anyway once we reach the end of the code (so maybe one of your statements is inadvertently calling this method again)....

    Comment

    • stroken
      New Member
      • Mar 2007
      • 24

      #3
      If the if-statement is true, you will be stucked forever - you call the same method with the same parameters again, again... (if you dont modify any of them - but you dont show much code)

      Post the whole method to get better help,... and perhaps the problem is not in the method, it might be where you call the method.

      Comment

      Working...