if tests commands.
if [ ... ] works because
[ is a command (
/usr/bin/[ or a builtin (usually the latter)) that expects
] as its last argument (just to make things look pretty). But other than that, it takes parameters, which needs to be passed as usual—as a space separated list.
If you don't want to use
[, you can do:
if test $i != 10; then and it will behave exactly the same.
[[ in bash, which is a proper grammar construct that creates a separate context, which allows you to use things like
&& in it with semantics different from what they would mean in a usual command invocation (
test are just command invocations), but you still need spaces around