a question about state changes

so im trying to get a button to serial print when the button is pushed or let go off as in only serial print the state of the button at the start and end of the pushing

so I looked at the tutorial below but it seamed to be more about counting the number of button pushes

so would anyone be able to point me in the right direction as to a sample script of what im looking for ?

if (currentState != previousState)
{
     Serial.print(currentState);
     currentState = previousState;
}

When you ask your questions you should always let us see what you have tried to solve the problem yourself.

As far as the examples in the IDE, treated these examples as nothing more than techniques.

You will never find an example that does exactly what you want.

munch15a:
so I looked at the tutorial below but it seamed [sic] to be more about counting the number of button pushes
https://www.arduino.cc/en/Tutorial/StateChangeDetection

Just leave the counting part out then. Don't do the ++ increment, and delete the part where it toggles the led at the bottom of loop().

The inner if/else does exactly what you want, with a message for a press and a different message for a release.

(evanmars' solution does what you want the way you described it, and is a bit simpler, but if you ever need to distinguish between a press and a release (as opposed to just seeing a change regardless of which way) then you need the more complete change as in the tutorial.)

sorry for the long delay in posting works been too busy but thank you for all the help going to follow up your advice