There was another option: .... That just assumes ex_func() is made by you, and set the ex_var in it.
In the real case, the function isn't made by me.
Pascal syntax was made to be clear. Probably you will need more lines to implement, but it will be more readable.
I agree, and I like it. Compared to C possibilities to cryptify source code, the one-liner here is obvious to the reader and just convenient.
Cramping "everything" into a single line of code will cost you hours of debugging months later when you'll have forgotten all the details.
It isn't as if the line I asked for is so cryptic to not get the idea behind this. (I know what you mean when you're talking about C though.)
The problem is that in the Pascal construct if expression then statement, expression must be something that can be evaluated to boolean. The feature you speak about for example is more useful with languages that makes shortcuts in their if expression:
if (auto vt = "key" in AA) {}
<=>
ValueType* vt = "key" in AA;
if (vt != null){}
or
if (size_t len = array.length) {}
<=>
size_t len = array.length;
if (len != 0) {}
Because here the if expression allows to pass a pointer or an integral type (and boolean types of course), then the feature your speak about is yet more interesting.
I'm not sure if I get you right. The examples you constructed do not make it obvious to me why in Pascal this shouldn't be allowed. Unless this "feature" is just not supported in Pascal, meaning, assignments in the expression area are not allowed. - To my knowledge, I could construct similar code for pointer and integer types (and pass them). Hence, not sure about this remark.
It is about that the assignment operator in C language returns the value and in Pascal does not.
That makes sense, since
if ( ex_func( ex_param ) = 0) then
begin
//whatever
end;
works.
I would have expected the assignment operator would return the value to the variable which then would be evaluated by the if-statement. Then both expressions (C and Pascal from OP) should work the same. - If the assignment operator in C assigns AND returns (like a function) but the Pascal assignment operator just assigns, the if-statement at the same time does not evaluate the variable value but the return value, I see that it never could work.
Thanks for the clarification!