row - selectedX = 2;
first off,you're lacking an equal sign if you are trying to compare values
that part is having an error because you used the assignment(=) operator
assignments should be like this:
variable_being_assigned = value_to_be_assigned
secondly
i don't quite get your problem
with your if statements,the u,d,l,r are return values
in switch case statements,
when you say case 'u',it means that char 'u' is the input