Say I define a function f[x_, y_]:= ...
, the concrete definition of which is not important now.
What is important though is, that I want x
to be a real number, and y
to be a boolean variable, such that it can only have value True
or False
.
The former I can do by f[x_Real, y_]:= ...
, such as described here in the help for "patterns", under "Specifying Types of Expression in Patterns".
However there does not seem to be an equivalent boolean type. Or at least, it is not simply y_Boolean
.
Does anyone know how to do this? Thanks for suggestions!
f[x_?NumericQ, y_?BooleanQ]:=...
$\endgroup$