Got my first arduino yesterday and can't make it work

Yesterday I got 2 Arduinos Nano 33 BLE, installed the IDE with ArduinoBLE and Arduino_LSM9DS1 library.

First, I run the blink example and all worked well, but then, I tried to run the following code and the IDE just keeps on a infinite "sending" state.

#include <Arduino_LSM9DS1.h>

float x, y, z, delta = 0.05;
void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:
  if (IMU.accelerationAvailable()) {
    IMU.readAcceleration(x, y, z);
    Serial.println(x);
    delay(1000);
  }
}

On the second arduino, after uploading the code, it gets disconnected (disappears from device manager) and the only way to get it back is to click 2 times on the reset button.
The error is "Board at COM4 is not available"

Am I doing something wrong?

You are using Serial.println() without first using Serial.begin(baudrate), typically done in setup().

Usually a library comes with its own examples (File->Examples->LibraryName->). See if there are any there that will help you get the basics right.

You're right, but unfortunately that didn't solve my problem.

1 board keeps disconnecting after uploading the code and the other one keeps freezing on the "Uploading..."

Any idea what is happening?
Do you think I have 2 broken boards?

Your code is missing vital initialization, look at an example for starters.