You could avoid this test by doing

case 3:
  var out = ...
  // this stuff
case 2:
  // the rest