# What are the equality operators in Stan functions?

``````model {
N=10
theta = [0.2,0.5,0.3]
n ~ binomial(N, theta)
y ~ (how to write the formula?);
}
``````

I want y ~ distribution1 if n=0, distribution2 if n>0.

If there is an “equality operator” I might be able to write
y ~ (n==0)*distribution1 + (n!=0)*distribution2
but I cannot find an equality operator or any other logic operators (and, or, xor etc) in the reference.

How is the STANic way to write such a distribution? Many Thanks!

All of the standard logical flow operators are available, so you would do something like:

``````if (n > 0) {
...
} else {
...
}
``````
2 Likes