Heiholf
❔ Convert void to bool
I know that this question is totally weird and I would never try to use this in clean/maintainable code. However that is not my goal.
I'm writing code for Sebastian Lague's Chess Bot Tournament and try to reduce the number of tokens in code (and cannot use
unsafe
environments).
I have three functions like this:
And I want to execute them in order and keep the return value of B()
.
One way to accomplish is like that:
But it seems to be not the optimal way to minimize tokens. I would except to be a workaround like this:
However, I was unable to find a way to bodge the toTrue/toFalse
statements and Google didn't help because it just shows questions of people not understanding what void
is.
One could obviously wrap A
in a function, which invokes it and returns a bool
but it generates to many "boilerplat" tokens.
Is there any way to achieve this or is C# to securely designed to do this?22 replies