LCD programming (beginner)

Hello,

I'm just starting out on my Arduino and programming journey and I'm having a wee bit of trouble getting one of the test Sketches from the book "Getting started with Sketches" to work.

I'm doing the "USB message board" using the LCD hat with 6 buttons on it. I typed the code in and keep getting these error messages:

"Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"

C:\Users\sketch_jan03a_usb_message_test_not_working\sketch_jan03a_usb_message_test_not_working.ino: In function 'void loop()':

sketch_jan03a_usb_message_test_not_working:34:11: error: expected '}' before 'else'

else

^~~~

sketch_jan03a_usb_message_test_not_working:36:19: error: 'ch' was not declared in this scope

lcd.write(ch);

^~

C:\Users\Adam\Desktop\Arduino Test Sketches\sketch_jan03a_usb_message_test_not_working\sketch_jan03a_usb_message_test_not_working.ino: At global scope:

sketch_jan03a_usb_message_test_not_working:39:1: error: expected declaration before '}' token

}

^

exit status 1

expected '}' before 'else'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences."

Not sure where I went wrong.

Here is my code:

#include <LiquidCrystal.h>

// lcd(RS, D4, D5, D6, D7)
LiquidCrystal lcd (8,9,4,5,6,7);
int numRows = 2;
int numCols = 16;

void setup()
{
Serial.begin(9600);
lcd.begin(numRows, numCols);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Arduino");
lcd.setCursor(0,1);
lcd.print("Rules");

}

void loop()
{
if (Serial.available() > 0)
{
char ch = Serial.read();
if (ch == '#')
{
lcd.clear();
}
else if (ch== '/');
{
//new line
lcd.setCursor(0,1);
}
else
{
lcd.write(ch);
}
}
}

The error messages give you the line number and a position location on that line where the error was detected. Have you attempted to correct the errors?

Paul

else if (ch== '/');

You don't need the ;

For future posts please put code in code tags (<> in the edit toolbar). This prevents the forum posting software from interpreting combinations of characters into smileys, etc. and makes it easier to read.