1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed LEAVE N not working

Discussion in 'Support' started by vefatica, Jan 11, 2015.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,972
    Likes Received:
    30
    I have several examples. Here's the simplest one. I would not expect to see the "left inner do" message at all. And I would expect that, in the end, i and j are both 1. But ...
    Code:
    v:\> type leaven2.btm
    do i=1 to 2
        do j=1 to 2
            leave 2
        enddo
        echo left inner do
    enddo
    echo i = %i and j = %j
    
    v:\> leaven2.btm
    left inner do
    left inner do
    i = 3 and j = 1
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,870
    Likes Received:
    83
    Fixed in build 71. (It didn't work in at least the last couple of versions.)
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,972
    Likes Received:
    30
    I know. Recall the thread in the beta forum. :-)
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,972
    Likes Received:
    30
    I think it's working correctly. My first test failed miserably, apparently because LEAVE's argument can't be in a variable. Could you expand LEAVE's argument?

    I had to replace
    Code:
    leave %zz
    with
    Code:
    iff %zz == 1 then
       leave 1
    elseiff %zz == 2 then
       leave 2
    elseiff %zz == 3 then
       leave 3
    endiff
    I also noticed that LEAVE (ITERATE also) is not echoed when echo is on ... WAD?
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,972
    Likes Received:
    30
    And LEAVE can't be "stepped into" in the debugger (I didn't check ITERATE). Both are unlike GOTO which is a seemingly analogous command.
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,870
    Likes Received:
    83
    LEAVE is not a command, so it doesn't (can't) have variable expansion, nor can you echo it or step into it in the debugger. LEAVE and GOTO are about as similar as REM and COPY!
     
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,972
    Likes Received:
    30
    So is variable expansion in a future version out of the question?
     
  8. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,870
    Likes Received:
    83
    You can add it to the feedback forum. But it will require a parser rewrite.
     

Share This Page