How to copy one field to another when a condition or other field is checked off

How to copy one field to another when a condition or other field is checked off

I have never used Custom Functions.  So if anyone has experience in this, please assist on this.

I want to be able to have one main address listed and a separate address listed if different from first.  But I need the second address filled out automatically (copied from first) if it is not different.

This is commonly used when checking out on an ecommerce site when billing and shipping are different.  I need this information to be exported to a form out of Zoho.  I don't want my users having to manually copying and pasting data when it is already there and should be able to be copied automatically when a checkbox is checked.

Any suggestions?