The following code works as expected.
\documentclass[tikz,margin=1em]{standalone}
\usetikzlibrary{math}
\begin{document}
\begin{tikzpicture}[scale=3]
\draw (0,0) circle [radius=1cm];
\foreach \a in {0,30,...,330}{
\draw (\a:1cm-1pt) -- (\a:1cm+1pt);
\tikzmath {
int \b;
if \a<90 then { \b = \a; } else {
if \a==90 then { \b = 0; } else {
if \a<270 then { \b = \a+180; } else {
if \a==270 then { \b = 0; } else {
if \a<360 then { \b = \a; };
};
};
};
};
};
\draw (\a:1cm+1pt) node[rotate=\b,anchor=west] {$\a^\circ$};
}
\end{tikzpicture}
\end{document}
Can this code be extended to set the anchor values of the nodes from a variable set within the conditionals? Something like the following dysfunctional code.
...
\tikzmath {
int \b;
if \a<90 then { \b = \a; \c = west; } else {
if \a==90 then { \b = 0; \c = south; } else {
if \a<270 then { \b = \a+180; \c = east; } else {
if \a==270 then { \b = 0; \c = north; } else {
if \a<360 then { \b = \a; \c = west; };
};
};
};
};
};
\draw (\a:1cm+1pt) node[rotate=\b,anchor=\c] {$\a^\circ$};
...
Obviously the math library is not intended to handle this.
Sure, I could just split the loop but isn't there something more straight forward?