switch e { case {next = {next = null}, data = a}: return a; case {next = null, data = a}: return a + 1; case _: return 0; }