Hi again,
Note that buf
is immutable (it’s an Int
), which is why you can’t pass it directly to Irecv!
as a buffer.
When you wrap it in an array, as in [buf]
, you’re passing Irecv!
a single-element array. That function then replaces buf
by the received value. Note that the array is being modified, not buf
itself (which, again, is immutable). In your last bit of code, you’re losing the received information since the array is anonymous. That’s why you need to attach the array to a variable (like mid
in your previous code).