# problem on returning value of function as a list using if

today i was writing a function for my project using mathematica that gives a line equation in form of $y=mx+b$ and a circle equation in form of $x^2+y^2=r^2$ and finds the intersection point which is on the left side of circle($x<0$)

intersectionPoint[eqLine_, eqCircle_] :=
Module[{eq1 = eqLine, eq2 = eqCircle, pts, x1, x2, a},
pts = NSolve[eq1 && eq2, {x, y}];
x1 = x /. pts[[1, 1]];
x2 = x /. pts[[2, 1]];
if[x1 < 0, a = pts[], a = pts[]];
a
];


So for a input like this

b = intersectionPoint[y == 0*x + 4, x^2 + y^2 == 25]


I expect b should be equal to this

{x -> -3., y -> 4.}


{x -> 3., y -> 4.}


I read the wolfram If reference and in Generalizations part there was something like this

In:=x = -2;
If[x < 0, y = -x, y = x]; y
Out= 2


I can't understand why my function does not give me my expected result.

I found a couple typos in your code, the most glaring being the lower-case if. This seems to work,
intersectionPoint[eqLine_, eqCircle_] :=