File tree Expand file tree Collapse file tree 3 files changed +13
-28
lines changed Expand file tree Collapse file tree 3 files changed +13
-28
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ Note: [
31
31
no-load: [{cannot load: } :arg1 ]
32
32
exited: [{exit occurred} ]
33
33
deprecated: {deprecated function not allowed}
34
- else-gone: {ELSE is obsolete - use the EITHER function}
35
34
]
36
35
37
36
Syntax: [
Original file line number Diff line number Diff line change @@ -186,11 +186,10 @@ halt: native [
186
186
]
187
187
188
188
if: native [
189
- {If condition is TRUE, evaluates the block .}
189
+ {If TRUE condition, return arg; evaluate blocks by default .}
190
190
condition
191
- then-block [block! ]
192
- /else "If not true, evaluate this block"
193
- else-block [block! ]
191
+ true-branch
192
+ /only "Return block arg instead of evaluating it."
194
193
]
195
194
196
195
loop: native [
@@ -306,9 +305,10 @@ try: native [
306
305
]
307
306
308
307
unless: native [
309
- {Evaluates the block if condition is not TRUE .}
308
+ {If FALSE condition, return arg; evaluate blocks by default .}
310
309
condition
311
- block [block! ]
310
+ false-branch
311
+ /only "Return block arg instead of evaluating it."
312
312
]
313
313
314
314
until: native [
Original file line number Diff line number Diff line change @@ -597,17 +597,6 @@ enum {
597
597
}
598
598
599
599
600
- /***********************************************************************
601
- **
602
- */ REBNATIVE (else )
603
- /*
604
- ***********************************************************************/
605
- {
606
- Trap0 (RE_ELSE_GONE );
607
- DEAD_END ;
608
- }
609
-
610
-
611
600
/***********************************************************************
612
601
**
613
602
*/ REBNATIVE (exit )
@@ -625,16 +614,13 @@ enum {
625
614
/*
626
615
***********************************************************************/
627
616
{
628
- REBVAL * cond = D_ARG (1 );
629
- REBVAL * body = D_ARG (2 );
630
-
631
- if (!D_REF (3 )) { // no /else
632
- if (IS_FALSE (cond )) return R_NONE ;
633
- } else
634
- if (IS_FALSE (cond )) body = D_ARG (4 );
635
-
636
- DO_BLK (body );
637
- return R_TOS1 ;
617
+ if (IS_FALSE (D_ARG (1 ))) return R_NONE ;
618
+ if (IS_BLOCK (D_ARG (2 )) && !D_REF (3 ) /* not using /ONLY */ ) {
619
+ DO_BLK (D_ARG (2 ));
620
+ return R_TOS1 ;
621
+ } else {
622
+ return R_ARG2 ;
623
+ }
638
624
}
639
625
640
626
You can’t perform that action at this time.
0 commit comments