Comment Comment by bananaface Why not just: function foobar(version: number): string { if (version >= 3) { return 'result_3'; } else if (version >= 2) { return 'result_2'; } else if (version >= 1) { return 'result_1'; } else { throw new Error(`Cannot interpret version '${version}'`); } } ?I don't see what advantage the switch provides here. parent bananaface 5 years ago
I don't see what advantage the switch provides here.