Simple thing I want to do:
Create a variable equal to the sum of four dummies x1 + x2 + x3 + x4 with x1 and x2 being single select questions (1. Yes, 0 No). and x3 and x4 being Bolean variables.
The expression x1 + x2 + x3 + x4 gives an error and doing x1 + x2 + (int) x3 + (int) x4 does not solve the problem as the error message says “Cannot convert type bool into int”.
Thanks for your help. More generally, is there a manual about basic and more advanced variable expressions?
Use the ternary operator: (x3==true)?1:0
We use C# language for writing expressions, so any standard book or website on C# will do.
DotNetPerls is a site which I often peek to.
It covers topics by examples with comments which is often simpler than an abstract explanation.
Your specific question is here:
with a specific mentioning that the cast will not work
Formal C# language description is available from Microsoft:
Yet, since we are not really programming in C#, just writing expressions, you will not get to using most of this machinery.