This is not an answer, as I don't think it's fair to do other people's homework. It's sort of a hint, so that you can find the answer yourself.
At a first glance, these two pieces of code seem to be equivalent. At a second one, they may not be. In which order are p1
, p2
, ..., pn
evaluated in each piece of code? If the order is not (necessarily) the same, does it matter? Can you choose p1
, p2
, etc. so that it matters in which order you evaluate them?
I assume that the purpose of this exercise is not to teach you Pascal, but to teach you about evaluation order and how different languages specify it (or do not specify it).