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

  1. if you have a switch within a switch and use the character % within the line comment ";#" -- it breaks, without it doesn't
  2.  
  3. ------
  4. Without %
  5.  
  6. set animal dog
  7. switch $animal {
  8. dog {
  9. set animal2 cat
  10. switch $animal2 {
  11. cat {
  12. puts "Meow"
  13. }
  14. default {
  15. puts "Moo"
  16. } ;# end case default
  17. } ;# end switch animal 2
  18. puts "bark!"
  19. } ;# end case dog
  20. } ;# end switch "animal"
  21.  
  22. works as expected.
  23.  
  24. > Meow
  25. bark!
  26.  
  27. ----
  28.  
  29. set animal dog
  30.  
  31. switch $animal {
  32. dog {
  33. set animal2 cat
  34. switch $animal2 {
  35. cat {
  36. puts "Meow"
  37. }
  38. default {
  39. puts "Moo"
  40. } ;# end case default
  41. } ;# end switch animal 2
  42. puts "bark!"
  43. } ;# end case dog %
  44. } ;# end switch "animal"
  45.  
  46. > throws: extra switch pattern with no body -- is this normal?
  47.