Our teacher has given us an assignment but I am not sure where to start.
We have to make a code that will read the serial monitor, and when we type a certain word, it will respond with another word. So when I type "Tick", it should fire back "Tock"
void setup is the place where you setup your stuff. declare the pins, instantiate stuff, etc.
it is also where you place the code you want it to run only at the start.
void loop is the main program. as the name suggests, this function keeps repeating itself. this is also the place where the program 'waits' for input, so to say.
there are several sketches online, as well as under arduino ide > file > example > communications
though i would recommend online.
if u need a direction, u can try Serial.available() and Serial.read.
The serial input basics thread was already mentioned. Example 2 can be applicable, else example 3.
Once newData is true, you can process the received characters. To compare text, you can use strcmp; it will return 0 if the two strings match. If there is a match, you can send a desired text back to the pc using the already mentioned serial.println.