Sign Up

Conditionals

Condition Command

The Condition Command allows you to perform actions based on whether an expression evaluates to true or false. You can nest other commands within the true or false branches of the condition, enabling complex logic flows.

-

Key Features:

  • Expression Builder: Validate two variables to equal true. Multiple expressions can be added; all expressions must be true for the condition to pass.

  • Nested Commands: Commands can be nested within the true and false branches.

  • Else If and Else Blocks: Support for multiple else if statements and a single else block, each containing its own nested commands.

Switch Command

The Switch Command allows you to validate a single variable against multiple case values. Each case can contain nested commands that will execute if the case value matches the variable. Additionally, a default block can be provided to handle cases where none of the specified cases are true.

-

Key Features:

  • Case Validation: Compare a variable against multiple case values.

  • Nested Commands in Cases: Each case block can contain commands that will execute if the case value matches the variable.

  • Default Block: When no cases match, the flow will enter the default block containing its nested commands.

Validate Command

The Validate Command ensures that specific expressions evaluate to true. If any of the expressions are false, the validate command will throw an error. You can specify custom error messages and server errors, including common HTTP status codes such as Bad Request, Unauthorized, etc.

-

Key Features:

  • Expression Validation: Validate multiple expressions.

  • Error Handling: Throw an error if any expression fails.

  • Custom Error Messages: Specify custom error messages and server error codes.

These commands enhance your ability to build complex, condition-based logic flows without having to write code. Utilize the Condition, Switch, and Validate commands to control the workflow dynamically based on variable values and expressions.

Related Topics

Send Message

Send SMS Command. With Twidget, you can send SMS messages to phones using the `Send SMS` command. This functionality varies depending on the provider. Currently, we support Twilio as the SMS provider. To use Twilio for SMS integrations, you will need: - A Twilio account ID - Twilio Auth Token - A Tw...

Variables

Variables are essential building blocks in Twidget that allow you to store and manipulate data dynamically within your no-code applications. They enable you to create flexible and interactive applications by holding values that can be changed and referenced throughout your workflow. Creating Variabl...

Security

Twidget provides several built-in functions to enhance the security of your applications. Below is an overview of each security command, including its description, inputs, and outputs. Generate ID. Description: Generates a unique identifier. None - Type: Text Hash Text. Description: Hashes the provi...

Return

The `return` command in Twidget is a special command used to halt the current command workflow and immediately return a specified result. This command overrides any subsequent processes and outputs the return result regardless of the rest of the workflow logic. This command is particularly useful fo...

Database

Twidget offers many commands to manage data in your database. Below is a list of the available commands and their functionalities: Get Data. Retrieve an entry from a table. Get Multiple Data. Retrieve multiple entries from a table. Save Data. Save an object to a database table. Save Multiple Data. S...