Painting A Unity3D Terrain Via Script

Im looking for some help/insight on how i would go about painting a terrain during runtime through a script on Unity3D. Ive seen some links to different pages such as

Unity - Scripting API: TerrainData Unity - Scripting API: TerrainData.splatPrototypes

But im still not exactly sure how to use these to do what i want to do, if someone could explain it ( Not even asking for a exact line for line ), that would be great. I just want to understand what im doing, understand how to do it, and etc. Thanks in advance guys!

Thank @tanoshimi for this…