one-line if syntax vs conditions in text substitutions

I just noticed something.

This is legal:

say "[if foo is true]Foo[otherwise if bar is true]Bar[otherwise]Baz[end if]."

But this is not:

if foo is true, say "Foo.";
otherwise if bar is true, say "Bar.";
otherwise say "Baz."

I had been going on the assumption that one-line if statements followed the same restrictions as conditions in text substitutions, but I guess I was wrong. Why are they different?

They’re different pieces of syntax, defined by different parts of the languaage. Why would you expect them to be the same?

I suspect the answer is that “if” substitutions can’t be nested, and that prevents ambiguities about what the “else” matches. You can resolve those ambiguities by using begin/else form, or indentation form, which is why those forms work for nested “if” statements.

I don’t prefer this design – I’d rather “if” be nestable in all forms – but I think it’s how it arose.