The D Programming Language: cases

Matt Landau mlandau at bbn.com
Thu Mar 3 11:49:12 AEST 1988


In comp.lang.c (<2403 at umd5.umd.edu>), chris at trantor.umd.edu (Chris Torek) writes:
>While this would work, if we assume D has aggregate constructors,
>there is a handsomer way:
>
>	switch (e) {
>	case [1, 2, 3, 5, 7, 13, 19, 23]: ...
>	}
>	/* syntax above is only for demonstration */

And of course we add ranges, giving

	switch(e)
	{
	  case [1, 2, 3..7, 13, 19, 23..36]:
		.
		.
		.
	  default:
		.
		.
		.
	}
	/* what he said */



More information about the Comp.lang.c mailing list