Compiler error with logical bitwise operations

Hi, I am trying to set the top for bits on a word before sending it to the SPI bus. If I set the word with a discrete value, the program will compile. If I perform a logical bit operation, the compiler gives an error shown below. I'm not sure why the compiler believes there is a ; missing, obviously my syntax is wrong but according to the tutorial my syntax is correct.

SignalGenerator:55: error: expected ';' before 'value'

   value = 0b0011000000000000 | value; // set top 4 bits

   ^

exit status 1
stray '\315' in program

code that doesn't compile

void dacWrite(word value) {
  value = 0b0000111111111111 & value; // clear top 4 bits
  value = 0b0011000000000000 | value; // set top 4 bits

  // take the SS pin low to select the chip:
  digitalWrite(slaveSelectPin, LOW);
  SPI.transfer(highByte(value));
  SPI.transfer(lowByte(value));

  
  // take the SS pin high to de-select the chip:
  digitalWrite(slaveSelectPin, HIGH);
}

code that compiles

void dacWrite(word value) {
  value = 0b0000111111111111; // & value; // clear top 4 bits
  value = 0b0011000000000000; // | value; // set top 4 bits

  // take the SS pin low to select the chip:
  digitalWrite(slaveSelectPin, LOW);
  SPI.transfer(highByte(value));
  SPI.transfer(lowByte(value));

  
  // take the SS pin high to de-select the chip:
  digitalWrite(slaveSelectPin, HIGH);
}

You copied something from awebpage. Remove the line and type it literally.

Thanks, that did the trick. :slight_smile: