When I do this:
Apply[(If[#2 == what, "yay", If[#2 == whoops, "nay"]]) &, {-5, what}]
I get:
yay
But when I do this:
Apply[(If[#2 == what, "yay", If[#2 == whoops, "nay"]]) &, {-5, whoops}]
I get:
If[whoops == what, "yay", If[whoops == whoops, "nay"]]
This setup does work for numbers:
Apply[(If[#2 == 2, "yay", If[#2 == 3, "nay"]]) &, {-5, 3}]
nay
What I was trying to do was when I got stuck here was define a VertexRenderingFunction
in a GraphPlot
VertexRenderingFunction -> ({White, EdgeForm[Black], Disk[#, {2, 1}],
Black, Text[
If[#2 == alpha1, "Alpha",
If[#2 == beta, "Beta",
If[#2 == alpha2, "Alpha",
If[#2 == gamma, "(70,55)",
If[#2 == delta, "(90,50)"]]]]], #1]} &)
What am I doing wrong? Any help will be greatly appreciated. Thanks.
If
. See docs. $\endgroup$TrueQ[]
worked but why was == working on the outsideIf
and not on the insideIf
? $\endgroup$Switch
andWhich
, which are both easier to manage than nestedIf
statements. $\endgroup$