When I came to China, I didn't speak Chinese, but when I left, I did.
or should it be
When I went to China.....
"When I came to China" would indicate that you are still in China, so in this example, it should be "When I went..."
Originally Posted by solskinsglad
When the students come to class in the morning, it's only because they know that learning Enlgish is a good idea - not beacuse they want to study.
or should it be
When the student go to school...........
(said when you are outside of the school)
This one is a bit different, because you are talking about a general truth, rather than a specific incident. Using "when students come to class" would indicate that you are present when it happens. However, it wouldn't necessarily indicate that you are in the location when you are saying it, as the China example would.
Another situation where it would be acceptable to use "come" when you are referring to a different location to the one you are at would be when discussing the future. So for example, you would often say "Are you coming to the cinema tonight?" even though you aren't currently at the cinema. But it would indicate that you will be at the cinema. Whereas asking "Are you going to the cinema?" would suggest that you won't be there yourself.
So yes, you would use "come" when you are in the location, and "go" when you are not in the location, in whatever tense you happen to be using it in. It can indicate that you were in the location (past), you are in the location (present), you will be in the location (future), or you are sometimes/often in the location (present perfect).