helper.if

The If...Then...Else operator. Allows you to execute either one block of code or another, depending on the condition. If you need more options, use helper.switch.

For example, if you want to conduct a survey, you can use the helper.if component to ask the gender of the respondent and add different sets of questions, depending on whether the respondent is male or female.

How it works:

If the condition in if is true (returns true), the code specified in the then property will be executed. Otherwise (the condition is false and returns false) the code specified in else will be executed.

The else property is optional. For example, you ask a Toloker "do you like the image?". You can make a comment field appear when a negative response is selected. And if a positive response is selected then nothing happens.

To learn more about conditions, see the List of conditions.

View example
Components used in the example

Component properties

NameTypeDescription
type*"helper.if"Set component type.
condition*conditionCondition to check.
elseanyThe element that is returned if the condition from the condition property is false (returns false).
then*anyThe element that is returned if the condition from the condition property is true (returns true).
Contact support

Last updated: March 29, 2023

Introduction
Getting started
Important tips
Useful recommendations
Working with Toloka
Projects
Pools
Tasks
Results
Project analysis
Toloka settings
Task interface
Template Builder
HTML/CSS/JS editor
Help and support
FAQTroubleshootingSupportGlossary