Through ftp delete function.php or delete the whole theme. Download the last backup of your site from cPanel or whatever you are using, and than replace function.php or the whole theme
However, if you delete function.php or the whole theme you can access your site as admin at yoursite(dot)com/wp-admin and than change the theme
This is soooooo wrong!!!!!
There is a much simpler and safer way to do it. First though you must NEVER edit your main files because when there is another update you will lose any changes you make as wordpress over rides it. First you must get a child theme, this is common practice for wordpress users and is advised by wordpress.org the official site. All changes you make to your site should be done in there and not your main theme.
Once you have your child theme, copy the functions.php file and upload it to your child theme. Go to your adim and editor - Now you can make changes there.
If you make a mistake and your site is messed up just delete the php file in your child theme and your site will return back to normal.
You cannot break a website when using a child theme.
You do not need to delete a whole theme because you made a mistake in one file
You do not need to access admin to change your theme
Simple and quick to do
Wordpress looks in the child theme first, if the changed functions.php ( or whatever page or css ) is present it will use that and ignore the same files in the main code as a child theme over rides it, if changes are not present then wordpress will move on to the main code and use that.
so basically never ever change your main code, always use a child theme. You cannot break a site when using a child theme. That's why professional wordpress users always use a child theme as you cannot lose anything if something goes wrong.