Available argument signatures for Bernoulli: Real return type required for probability function

‘No matches for:
Available argument signatures for Bernoulli:
Real return type required for probability function’

parameters {
  ...
  real<lower=0,upper=1> pi[K];  //stan:2.21 array
  real<lower=0,upper=1> z[K,N];
  ...
}

model {
...
  for(i in 1:N) {
    for(k in 1:K) {
      pi[k] ~ beta(alpha, beta);
      z[k,i] ~ bernoulli(pi[k]);  //'No matches for: ...'
    }
  }
...
}

I wanna know how to change the codes so that it doesn’t report this error.

The bernoulli distribution is only for int data, you can’t use it for parameters

Thx a lot!