Depends a bit on your shell. That works great in bash. Other shells have different semantics. For example, zsh will wait for input until you type ^D or ^C and tcsh will complain about an invalid null command.
The variant I know that works identically in pretty much every shell I've ever tried is:
:>myfile.txt
And if you don't want to overwrite the file if it exists:
The variant I know that works identically in pretty much every shell I've ever tried is:
And if you don't want to overwrite the file if it exists: