「〜で」 shows the place where you do something. It is used with action words, as in 「食堂で昼ごはんを食べます」. To say where a person or thing is, use 「〜に」, so be careful of the difference between 「教室にいます」 and 「教室で勉強します」.
Examples
図書館で本を読みます。
I read books at the library.
公園で友だちと話しました。
I talked with my friend at the park.
Practice
1. 私は毎週土曜日、体育館( )バスケットボールをします。
It is the place where you do the action 「する」, so use 「で」. 「に」 is used for the place where a person or thing is, so it cannot be used here.
2. 昼ごはんは会社の食堂( )食べます。
It is the place where you do the action 「食べる」, so use 「で」. 「へ」 is a word for the direction you go.
3. 机の上( )ねこがいます。
「いる」 is not an action. It shows where someone is, so use 「に」. 「で」 is for the place where you do an action, so it cannot be used here.
4. Put the words in the right order.
牛乳を / きのう / スーパーで / 駅の / 買いました / 前の
Show answer
きのう、駅の前のスーパーで牛乳を買いました。 After 「場所+で」 comes 「〜を+動詞」.
5. Is 「弟は公園でサッカーをしています。」 used correctly?
It shows the place where you do the action 「サッカーをする」, so 「公園で」 is used correctly.