Question: assignment inside 3 argument if?

sometimes I have a need to do an assignment inside  operator call `if`(......) . but it is not possible it seems to do this in Maple.

This happens when I am using `if`(...) inside cat() to build a long string, and  depending on some condition, different string is build.  

This works fine in general, until I need to assign new value to a variable at the same time as I am building the string.

An example will make it more clear. Instead of the following

str:="A";
x:=10;

str:=cat(str,`if`(x=10," it was 10","it was not 10"));

if x=10 then
   x:=11;
else
   x:=9;
fi;                         

I'd like to do something like this (which does not work in Maple)

str:="A";
x:=10;
str:=cat(str,`if`(x=10,  x:=11;" it was 10" , x:=9; "it was not 10"))

Tried assign() also. Does not work.  I tried different variation on the above, none works. 

In Mathematica, the above is possible. But this is using standard `If`, which can be inlined

Is it possible to do something like this in Maple? 

The reason is that I do not have to do the checking twice: once to build the string, and once after that is done, in order to do the assignment. It is better if both are done in one place. The above is just an example. I could have more than one `if` inside as I am building the long string. 

Btw, how does one look up help on the operator if and not the statement if ? the help page for if does not talk about it or give any examples.

Maple 2020.2

Please Wait...