Conditional Value

BlockLogic

Compare two values and output one of two values based on the result.

Inputs

Value 1Required

The first value to compare.

Example: hello

ConditionRequired

The comparison operator.

Optionsequals (=)equals (case insensitive)equals (numeric)equals (float)does not equal (!=)does not equal (case insensitive)greater than (>)greater than (float)less than (<)less than (float)greater or equal (>=)greater or equal (float)less or equal (<=)less or equal (float)containscontains (case insensitive)does not containdoes not contain (case insensitive)is in the comma-separated listis in the comma-separated list (case insensitive)is not in the comma-separated listis not in the comma-separated list (case insensitive)starts withstarts with (case insensitive)does not start withdoes not start with (case insensitive)ends withends with (case insensitive)does not end withdoes not end with (case insensitive)is emptyis not empty
Value 2Required

The second value to compare.

Example: hello

Output if TrueRequired

The value to output when the condition is true.

Example: yes

Output if FalseRequired

The value to output when the condition is false.

Example: no

Outputs

Output

The selected output value.

Example: yes

Build a bot using blocks like Conditional Value

Use this block in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.

Advanced Documentation

This documentation can be useful when using code mode. View as Markdown

ID: ternary_conditional_value

Inputs

FieldInventScript nameValue
Value 1value_1e.g. "hello"
Conditioncondition"equals (=)", "equals (case insensitive)", "equals (numeric)", "equals (float)", "does not equal (!=)", "does not equal (case insensitive)", "greater than (>)", "greater than (float)", "less than (<)", "less than (float)", "greater or equal (>=)", "greater or equal (float)", "less or equal (<=)", "less or equal (float)", "contains", "contains (case insensitive)", "does not contain", "does not contain (case insensitive)", "is in the comma-separated list", "is in the comma-separated list (case insensitive)", "is not in the comma-separated list", "is not in the comma-separated list (case insensitive)", "starts with", "starts with (case insensitive)", "does not start with", "does not start with (case insensitive)", "ends with", "ends with (case insensitive)", "does not end with", "does not end with (case insensitive)", "is empty", "is not empty"
Value 2value_2e.g. "hello"
Output if Trueoutput_if_truee.g. "yes"
Output if Falseoutput_if_falsee.g. "no"

Outputs

FieldInventScript nameValue
Outputoutpute.g. "yes"

Example InventScript

check := ternary_conditional_value(Args{
	value_1:         "hello",
	condition:       "equals (=)",
	value_2:         "hello",
	output_if_true:  "yes",
	output_if_false: "no",
})
send_text_message(Args{channel_id: trigger.channel_id, message_content: "Output: " + check.output})

More logic blocks