Help with Awk Syntax

I have written many awk commands which go in multiple lines.
I have this confusion many times.
Some time they work if i dont terminate them with "\" but some time error.
Some time in "if" statements between if and else if i dont use ";" it gives error but sometimes it doesnt.

The below code if i dont use ";" it gives error.

    nawk -F"|" 'NR==FNR{a[$1]=$7 OFS $6;next}  {\
 if (a[$2]) \
     print $1 OFS a[$2]; \
        else \
     print $1  OFS $3}'  OFS="|" \
    file1 file2

In the below code i am not using ";" between if and else if but it works

   nawk -F"|" '{ \
 if ($3 ~ "hm." && $5 == "" && $6 == "" && $7 == "") \
     {$9="Not";print $1,$2,$8,$9 } \
 else if ($3 !~ "hm." && $5 == "" && $6 == "" && $7 == "") \
     {$9="yes";print $1,$2,$8,$9} \
 else {print $1,$2,$3,$7,$8}}' OFS="," \
   file

Appreciate help in clarifing where to use ";" and "\'

Why are you using backslashes?

Get rid of them all.

If we break a single command to multiline then are we not suppose to use "\" at end of each line

Yes, for command lines but not in awk scripts.

The backslash is needed in awk, as in the shell, when the line would be taken as a complete command if the backslash were not there.

As if (condition) is not complete, there is no need for a backslash.