it looks like it's the same as a switch without a break in C

http://stackoverflow.com/questions/252489/why-was-the-switch-statement-designed-to-need-a-break

I created a brief example in C: I've always used breaks though in switches

https://ideone.com/2UYqg9


#include <stdio.h>

void test(val) {
printf("testing %d\n", val);
switch(val) {
case 1: //case.
printf("1\n");
break;
case 2: //fcase.
printf("2\n");
case 3: //case.
printf("3\n");
break;
case 4:
printf("4\n");
break;
}
return;
}
int main(void) {
test(1);
test(2);
test(3);
}


testing 1
1
testing 2
2
3
testing 3
3



On Wed, Mar 1, 2017 at 10:14 PM, 'Pascal Jasmin' via Programming <
[email protected]> wrote:

> Do not see the usefulness of the fcase. option.  see example here:
> http://www.jsoftware.com/help/dictionary/csel.htm
>
>
> I would see a "passthrough case" pcase. usefulness
>
> f2=: 3 : 0
> t=. ''
> select. y
> case.  1 do. t=.t,'one '
> pcase. 2 do. t=.t,'two '
> case.  2;3 do. t=.t,'three '
> case. 2;3;4 do. t=.t,'four '
> end.
> )
>
> f2 2
> two three
>
> a pcase. statement would not abort search after a match.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to