Look at the data sheet (product specification) of the nRF52840 (available at Nordic). You can access the registers directly via pointers to the periphery modules (here GPIO). Because all ARM micro-controllers are rather similar, you can learn also from Arduino Due (SAM3x, Cortex M3) or Arduino Zero (SAMD21, Cortex M0).
There are different registers for setting and resetting pins. So you can use the same mask for setting/resetting a pin or a group of pins.
But you may get problems, if you use the mbed-OS (e.g. if you run the ArduinoBLE library).
Till now, I had no problems with direct nRF52840 access in loop() without the ArduinoBLE library. With the BLE library I detected delays up to 5 milliseconds.
Good luck.