What is the function of を in the sentence:
Why can't it be written without it, like:
'を' is a particle that is used mainly as an object particle to
indicate a direct object of action.
Therefore, it needs to be used as you are asking what the object of doing is in the question.
I am doing my homework.
could be translated to
In formal Japanese, it is better not to omit 'を' in the sentence.