Skip to content

BOOLEAN_2_SCALAR

Takes boolean type data and converts it into scalar data type. 1 means true and 0 means false Params: default : Boolean The input boolean to which we apply the conversion to. Returns: out : Scalar The scalar result from the conversion of the input.
Python Code
from flojoy import flojoy, Boolean, Scalar


@flojoy
def BOOLEAN_2_SCALAR(default: Boolean) -> Scalar:
    """Takes boolean type data and converts it into scalar data type.
    1 means true and 0 means false

    Parameters
    ----------
    default : Boolean
        The input boolean to which we apply the conversion to.
    Returns
    -------
    Scalar
        The scalar result from the conversion of the input.
    """
    if default.b:
        return Scalar(c=1)
    return Scalar(c=0)

Find this Flojoy Block on GitHub

Example

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map

In this example, BOOLEAN node generates true. It converts its value to scalar type value and visualize it with BIG_NUMBER node.