This isn't "switch vs. router" — it's a question about one single switch's own capability. Can it move traffic between VLANs itself, or does every inter-VLAN packet have to leave the switch and come back?
A Layer 2 switch forwards frames using nothing but MAC addresses, entirely inside one VLAN — it has no concept of a subnet and cannot move traffic between VLANs at all without help from an external router. A Layer 3 switch (multilayer switch) is the same switching hardware with one thing added: an IP-routing engine built directly into the switch's own forwarding silicon, so it can route between VLANs internally, at switching speed, without ever sending the packet out to a separate router box. This is a different distinction from "switching vs. routing" as a contrast between two device types — this is about what a single device can do on its own once you add routing capability to its own hardware.