AccelStepper library help!

I'm new to this lib, and i want to know if it is possible to stop the movement of a stepper by pressing a button and store the position of it in a variable and how to do that, and thanks!

and i want to know if it is possible to stop the movement of a stepper by pressing a button

Of course it is.

and store the position of it in a variable

The position of the switch?

and how to do that

int var = digitalRead(switchPin);

In general they way that is done is to write code which works like this

move the stepper 1 step
add 1 to the stepper position
check is the button pressed
if the button is NOT pressed
repeat
else
stop

...R