Skip to content
Back to formatted view

Raw Message

Message-ID: <a1dc2ec7-3aa8-4311-8be4-b68bada686a9@l13g2000yqb.googlegroups.com>
Date: 2009-11-17T21:49:19Z
From: Stu
Subject: how can one break or stop or return from a script?
In-Reply-To: <p0624080cc727ab773a9c@[128.115.67.9]>

Thanks ...
It's good to know I'm not missing the obvious.
- Stu

On Nov 16, 8:31?pm, Don MacQueen <m... at llnl.gov> wrote:
> I don't know how to do this in the way you describe.
>
> Easy alternatives include:
>
> ? - putting the part of the script that is to be executed
> conditionally into a separate file, and then source it or not based
> on some condition.
> ? ?- simply wrapping the different parts of the script in if, then, else blocks.
>
> -Don
>
> At 1:37 PM -0800 11/16/09, Stu wrote:
>
>
>
>
>
> >Hi,
>
> >I am using a script to initialize variables in the global workspace.
>
> >Based on some condition, I would like to stop evaluation of a script
> >sourced on the command-line, without issuing an error.
>
> >My current solution is the following hack that uses a repeat { }
> >statement
>
> >----------- init.R -----------
> >#hack to enable setting of breakpoint
> >repeat {
>
> >...
> >if (condition) {
> > ? ? break;
> >}
>
> >...
>
> ># remember to break !!
> >break;
> >} #end repeat
> >EOF
>
> >Thanks,
> >- Stu
>
> >______________________________________________
> >R-h... at r-project.org mailing list
> >https://*stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
>
> --
> --------------------------------------
> Don MacQueen
> Environmental Protection Department
> Lawrence Livermore National Laboratory
> Livermore, CA, USA
> 925-423-1062
>
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.