This article explains how to use an HDMI switch with a laptop.
Guide to connecting the Nintendo Switch to a laptop
The short answer is yes, but the longer answer depends on your computer, switch, HDMI cable, and desired resolutions/frame rates. For most laptops, most HDMI cables, and most HDMI switches, everything will work out of the box; however, it can be a bit more complicated for more niche setups or when using older devices.
For example, if you're trying to output in 4K at 60 FPS, you'll need both HDMI cables and an HDMI switch that support that resolution at that frame rate. If you're unsure whether the hardware you have will work, short of trying it out yourself, you can search online for your specific cable or switch and see what features they support.
Before you begin, you will need a display, such as a monitor or TV, as well as an HDMI switch and HDMI cables that support the desired resolution and frame rate.