When to use '-이/가' or '-은/는'
I was wondering if anyone could help me further understand those two word markers. From my knowledge, '-이/가' is used for indicating the subject of the sentece and '-은/는' is used for indicating the the topic of the sentence. However I get so confused between which marker to use, as an example:
이것이 연필이에요.
= This is a pencil.
이것은 연필이에요.
한국말이 재미있어요.
= Korean is interesting.
한국말은 재미있어요.
What the difference ?! Also when can you tell which marker to use?! >.<'