# Assigning the answer of Solve to a variable [duplicate]

If I enter

Solve[(x-2)(x+2)==0,x]


then the answer comes up as

{{x -> 2}, {x -> -2}}


I want to make two variables sol1 and sol2, and sol1=2 and sol2=-2.

I don't mean I want to make sol1 and sol2 from {{x -> 2}, {x -> -2}}

I want to make them directly before anything such as {{x -> 2}, {x -> -2}} comes up.

As long as I get sol1 and sol2, I don't need such answers like {{x -> 2}, {x -> -2}}

I know it's possible because a year ago I could manage to do it after hours of trial-and-error.

But I don't remember now.

-
{sol1, sol2} = x /. Solve[(x - 2) (x - 2) == 0, x] ? –  Kuba Dec 7 at 9:57
@Kuba Thank you very much! :) –  user1849133 Dec 7 at 9:59
or you want to store them in a vector, then sol = x /. sol now you access first using sol[[1]] and the second using sol[[2]] –  Nasser Dec 7 at 10:12
Specifically this section of the "pitfalls" question: Using the result of functions that return replacement rules –  Michael E2 Dec 7 at 13:46