Define "The" (exact use of the word "the")

I want to know the exact use of the word “the”
I mean where and how to use it…

Articles-both definite and indefinite

“The” is used before noun.
I can show u when we can use “the” and when u can use “a”
When u talk about something at the first time, u should use “a”. E.g “I went to a restaurent last night”
But if u still talk about this thing u can use “the”. “The restaurent is on street Fourth”

there are still many rules for using “the” in English

thanks guys… it helps me alot