Create Function to Move Case Status to Closed

Create Function to Move Case Status to Closed

I am trying to write a function for a button that can move a case to closed status when the button is clicked, but I have no idea where to start. Any help would be appreciated!