Difference between 'Expression' and 'Statement' in Stan

Hi,

I am reading the reference manual of Stan and I feel confused about the difference between ‘expression’ and ‘statement’ in Stan. Although I know that they are referring to different things, is there more intuitive way to define their difference?

  • An expression denotes a value.
  • A statement causes some operation to be performed that changes state or affects control flow.

Evaluation of an expression requires computation. Execution of a statement changes program state in some way.

See https://mc-stan.org/docs/2_23/reference-manual/bnf-grammars.html

3 Likes