Posted to tcl by mookie at Fri Sep 27 22:51:12 GMT 2024view pretty

if you have a switch within a switch and use the character % within the line comment ";#" -- it breaks, without it doesn't

------
Without %

set animal dog
switch $animal { 
	dog { 
		set animal2 cat
		switch $animal2 {
			cat { 
				puts "Meow"
			}
			default {
				puts "Moo" 
			} ;# end case default
		} ;# end switch animal 2
		puts "bark!" 
	} ;# end case dog 
} ;# end switch "animal"

works as expected.

> Meow
bark!

----

set animal dog

switch $animal { 
	dog { 
		set animal2 cat
		switch $animal2 {
			cat { 
				puts "Meow"
			}
			default {
				puts "Moo" 
			} ;# end case default
		} ;# end switch animal 2
		puts "bark!" 
	} ;# end case dog %
} ;# end switch "animal"

> throws: extra switch pattern with no body -- is this normal?