How Can I write this Piston more concisely using variables?


I know that there is a much simpler way to write this piston using variables, but I’ve yet to use variables, and need some help.

This piston works as intended, and is pretty simple and self-explanatory, but I know it could be made less verbose. Could someone please show me how to write this using variables?

Thank you in advance!