As a conjunction:
* It joins two clauses, often expressing a reason or purpose.
* Example: "I stayed inside for it was raining."
As a preposition:
* It shows a relationship between a noun or pronoun and another word in the sentence.
* Example: "I went to the store for milk."
To determine its function in a sentence, look at the words around it and the meaning it conveys.