Er OK, this is more involved that I thought it would be. But that's OK.
I have Visual Studio Code 1.43.2, running on Ubuntu 18.04.4LTS.
I guess I could try running the same sketch on my Arduino IDE...
Which type arduino are you using? Some of the newer boards, such as the Nano Every, have changed to using an enum for digitalWrite, still uses HIGH and LOW but they are an enum of type PinStatus.
Makes sense, both the Uno WiFi Rev2 and the Nano Every use the Arduino MegaAVR core, and digitalWrite() uses an enum, which is known to break compatibility with code written for other cores.
hence why it's important to always respect formal type coherence... a pin status is not a boolean and relying on the compiler or to equivalence between values of constants to drive ones sketch is calling for trouble.
is also pretty poor, they should have pinned the type to uint8_t instead of the default which is an integer. That will drive more memory usage than necessary. They should have done
Great stuff. Thanks for the help. Problem solved. I can achieve everything I need in one line. I guess I'm using an out of date book (10 years old) for guidance...