No 8


I managed to get the right syntax but don't know how. Can anyone explain?? Thanks.


Please post your code and a link to the exercise. Thank you.


Can you talk me through the syntax on lines 2 and 7. Thanks.


Line 2 defines a function called quarter which as its name implies, will quarter any number passed in to it. So if we pass an argument of 12 in our function call, the return value will be 3.

Line 7 introduces an if statement that has as a conditional, a compound expression:

  1. a function call expression (which yields a value)
  2. a modulo expression, which yields a value
  3. an identity expression which yields a Boolean

The function call runs first, followed by the modulo and finally the identity test. 3 % 3 is 0 so that expression will yield true. With the conditional fully evaluated, we can now take the true branch of the control flow structure.


Will make notes from that. Thanks a mil..