An interjection expressing surprise, realization, or mild emotion (e.g., 'oh!', 'I see').
あ、なんだ。もう終わってたのか。
Oh — it's already finished?
なんだ、そんな簡単なことだったのか。
Oh, so it was that simple.
電気が消えていた。なんだ、ブレーカーが落ちていただけだ。
The light was off. Oh — the breaker had just tripped.
An interjection used to express annoyance, contempt, or disbelief (e.g., 'what the heck', 'what the...').
なんだ、それは!そんなルールはおかしいだろう。
What the heck is that! That rule is ridiculous.
どうして遅れたんだ?なんだ、寝坊か。
Why were you late? What— overslept?
そんな言い方はないだろう。なんだ、失礼だな。
You can't say that. What the— that's rude.