About
Watch[...]
is a helper function for watching a list of variables or other functions inside a Module[...]
during programming or troubleshooting.
Goal
Style Row[...]
separator so that printed values print apart with distinctively styled separator between items.
Two Coding Attempts
For first attempt (watch1[...]
) separator works but does not style separator. For second attempt (watch2[...]
) separator is itself styled but kernel complains by reacting with error codes and nothing else works.
list = {a, b, c};
Separator = ToString[Style[" | ", Darker[Green], Bold, 12]];
watch1[list_] :=
Print[Row[
Table[ToString[list[[i]]] <> Separator, {i, Length[list]}]]];
watch1[list]
watch2[list_] :=
Print[Row[
Table[ToString[list[[i]]] <>
Style[" | ", Darker[Green], Bold, 12], {i, Length[list]}]]];
watch2[list]
Specific Request
Please help by correcting code so that it works as cited in Goal.