Support conditionals that stop evaluation early #253
tangentstorm
started this conversation in
Ideas
Replies: 2 comments
|
+1 would love to see this! |
0 replies
|
It seems to have already been implemented in addons: sentence_that_fails_if_a_lt_0=: 3 : 0
assert y >: 0
%: y
)
sentence_that_fails_if_a_lt_0 9
3
sentence_that_fails_if_a_lt_0 _9
|assertion failure: assert
| assert y>:0
Press ENTER to inspect
load 'misc/miscutils/langexten'
sentence_that_fails_if_a_lt_0 and (>:&0) 9
3
sentence_that_fails_if_a_lt_0 and (>:&0) _9
0
NB. wrapper to demonstrate with (if.) control just like it was requested
wrapper=: 3 : 0
if. sentence_that_fails_if_a_lt_0 and (>:&0) y do.
echo 'condition is true'
sentence_that_fails_if_a_lt_0 y
else.
echo 'condition is false'
_42
end.
)
wrapper 9
condition is true
3
wrapper _9
condition is false
_42There is also |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Add the control words
and.andor.to allow things like-- @HenryHRich 12:14, 6 November 2017 (UTC)
All reactions