# Sampling statements conditional on integers

I am working with a model that involves n^\mathrm{th}-order random walks, for some positive integer n (typically 2 or 3). I’ll spare the details of the model - all that matters is that there is a parameter \theta in the model whose distribution should depend on the order of the random walk. Specifically, I would like to do something like this:

model{
if (n == 2)
theta ~ std_normal();
else if (n == 3)
theta ~ exponential(1);
...  //Rest of model
}



Of course, n is fixed data.

My question is whether or not this makes sense, or if it will be horribly inefficient. I don’t know much about the underlying behaviour of Stan in a situation like this, but my hope is that it would simply check n during initialization and subsequently use the corresponding sampling statement for every iteration. On the other hand, it may evaluate the conditions for n at every iteration. If so, would I be better off simply creating different Stan programs for the n = 2 and n = 3 cases?

yes, no problem with such approach - i have seen some similar examples