• stopping script execution from within a procudere

    From Michael Niehren@21:1/5 to All on Sat Oct 1 13:04:17 2022
    Hi together,

    take a look at the following example to see, what i want to do.
    We have 2 procecures:

    proc check {val} {
    if $val {
    uplevel 1 return
    }
    }

    proc a {} {
    check 1
    puts "end"
    }

    So i want to stop execution of proc "a" from within proc "check" and all the commands after the check-call should not be executed, but with
    "uplevel 1 return"
    this does not work.

    Does anybody know a solution ?

    best regards
    Michael

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ashok@21:1/5 to All on Sat Oct 1 16:58:31 2022
    (win) 46 % proc check {val} {if {$val} {return -level 2}}
    (win) 47 % proc a {} {check 1; puts "end"}
    (win) 48 % a
    (win) 49 %

    /Ashok

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Niehren@21:1/5 to Ashok on Sat Oct 1 13:51:05 2022
    Ashok wrote:

    (win) 46 % proc check {val} {if {$val} {return -level 2}}
    (win) 47 % proc a {} {check 1; puts "end"}
    (win) 48 % a
    (win) 49 %

    /Ashok

    Thank's for you help Ashok, that's it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Siri Cruise@21:1/5 to Michael Niehren on Sat Oct 1 05:18:47 2022
    In article <nnd$56fc4fe0$517083e1@29493ae6f380a245>,
    Michael Niehren <[email protected]> wrote:

    Hi together,

    take a look at the following example to see, what i want to do.
    We have 2 procecures:

    proc check {val} {
    if $val {
    uplevel 1 return
    }
    }

    proc a {} {
    check 1
    puts "end"
    }

    So i want to stop execution of proc "a" from within proc "check" and all the commands after the check-call should not be executed, but with
    "uplevel 1 return"
    this does not work.

    Does anybody know a solution ?

    best regards
    Michael

    Perhaps
    return -code return

    --
    :-<> Siri Seal of Disavowal #000-001. Disavowed. Denied. Deleted. @
    'I desire mercy, not sacrifice.' /|\ Discordia: not just a religion but also a parody. This post / \
    I am an Andrea Chen sockpuppet. insults Islam. Mohammed

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)