Problems with Code

I am trying to build a HM-10 bluetooth controlled RC- car that uses 4 motors connected to a motor driver. I am using an iPhone app that outputs F,B,R and L for forward, back left and right. The ports 4- 7 are right side forward, right side . reverse and vice versa for 6 and 7. I am having a variety of errors running the code and would appreciate any help .The code is below:

char m = 0;
#include <SoftwareSerial.h>
SoftwareSerial HM10(2, 3); // RX = 2, TX = 3

void setup() {

pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);

Serial.begin(9600);
HM10.begin(9600); // set HM10 serial at 9600 baud rate

}
void loop()
{
if (HM10.available()) // Read from HM-10 and send to Serial Monitor
Serial.write(HM10.read());

if (Serial.available()) // Read from Serial Monitor and send to HM-10
HM10.write(Serial.read());

m =Serial.read();
}
if (m =='F')
{
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
}
else if (m=='B')
{

digitalWrite(4, LOW);
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, HIGH);

}

else if (m=='R')
{

digitalWrite(4, HIGH);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, HIGH);

}

else if (m=='L')
{

digitalWrite(4, LOW);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
}
else
{
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
}

}

;

please read forum rules for posting code...

I am having a variety of errors running the code and would appreciate any help

care to elaborate? or are we supposed to guess?

[at a glance all your if are NOT in the loop() function. and you are not reading the command from the right place nor in the right way since you start by removing input from the buffer]

J-M-L:
please read forum rules for posting code...
care to elaborate? or are we supposed to guess?

expected unqualified-id before 'if'

fix your code in the first post please. Use code tags. (this is my last answer until fixed and you take the time to read the post pinned at the top of the forum)

nathans1001:
expected unqualified-id before 'if'

Yes as mentioned above... your ifs are outside the loop