pub enum Control {
If {
arms: Vec<Branch>,
otherwise: Option<Vec<Expr>>,
},
While {
test: Vec<Expr>,
body: Vec<Expr>,
body_first: bool,
until: bool,
},
For {
name: Option<String>,
source: Box<Expr>,
body: Vec<Expr>,
},
Select {
subject: Box<Expr>,
cases: Vec<Branch>,
},
Try {
body: Vec<Expr>,
catch: Vec<Expr>,
},
Return,
Break,
Branch(Box<Expr>),
Continue,
}Expand description
A control-flow sentence. Every body is a block: a list of sentences whose value is the last one’s.
Variants§
If
if. T do. B elseif. T do. B else. B end., and APL’s :If family.
The arms are tested in order; otherwise is the else. body.
While
while. and whilst., APL’s :While and :Repeat. body_first
runs the body once before the first test; until inverts the test.
For
for. y do. B end. / for_i. / :For i :In y. name binds each
item and <name>_index its position.
Select
select. T case. S do. B end. and :Select. A case with no test is
the default (case. do., :Else); fall_through is fcase..
Try
try. B catch. B end.. The catch block runs on a language error;
a gap in libjay itself is never caught.
Return
return. / :Return: leave the definition with the value in hand.
Break
break. / :Leave: leave the innermost loop.
Branch(Box<Expr>)
APL → e: continue at the line e names. An empty value falls
through to the next line; anything that is not a line of this
definition — →0 above all — leaves it.
Continue
continue. / :Continue: start the innermost loop’s next iteration.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Control
impl !UnwindSafe for Control
impl Freeze for Control
impl Send for Control
impl Sync for Control
impl Unpin for Control
impl UnsafeUnpin for Control
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more