Switzerland has a long history of being a neutral country, which means they don't pick sides in wars. This has helped Switzerland avoid many wars throughout history. However, they have still had a military to defend themselves if anyone tried to attack them.
One of the most famous events in Swiss military history is the Battle of Sempach in 1386. The Swiss were fighting against the Habsburgs, who had invaded their land. The Swiss soldiers were outnumbered, but they were able to use their knowledge of the terrain to their advantage and won the battle.
In the 19th century, Switzerland adopted a policy of armed neutrality, which means they would maintain a strong military to defend themselves, but they would not actively participate in wars. This policy has served them well, as Switzerland has not been involved in a major war since 1815.
During World War II, Switzerland remained neutral, but they did take steps to defend themselves. They built fortifications along their borders and mobilized their army. They were prepared to fight if necessary, but fortunately, they were able to avoid being invaded.
Today, Switzerland has a professional military, meaning that soldiers serve as their primary occupation. They also have a system of mandatory military service, which means that all young men are required to serve in the military for a period of time. This helps to ensure that there are enough trained soldiers to defend the country if needed.
In summary, Switzerland has a long history of being a neutral country that is prepared to defend itself if necessary. They have had some important military victories in the past and have maintained a strong military to protect their borders. While they have not been involved in any major wars in recent history, they remain prepared to defend themselves if needed.