# If Block

An If Block is used to make decisions are alter the code flow based on those decisions. In JavaScript this is basically an `if/then` statement.

In Lucid, to use an If block, first choose an 'If Block' from the 'Logic' menu. This will insert an If Block into your Workflow. You may double-click the action to edit it.

First, click 'Add Statement' this will add one If statement to the If block. You may have as many If statements as you like in one If block. In the table of If statements, you can edit 3 areas, first, the 'Evaluate' area.

## Evaluate

In almost all programming languages, including Javascript, an If statement needs to evaluate a statement to decide whether it should run the body of the statement. This is evaluation can only return one of two values, `true` or `false`. Most programming languages, for convenience can also consider `true` to be anything other than the number zero. An example evaluation would be: `i != 10` In this case, the variable 'i' is being compared to the number 10. The method of comparing is '!=' which means 'not equal to', and is the opposite of '==' which means 'equal to'. So in the event that i equals 10, the evaluation is false. If it is anything other than 10, then it is true. In the event that it is true, the function in the If block is called.

## Function Call

The function is called with the parameters that went into the If block. Lucid passes these parameters along wherever possible, so that at any point you may interrogate the senderObject and event for information. You may call any function you like from within the If statement, either a custom one created by yourself, or a Lucid action. You may also break away from the If block after the function is called, if you wish.

## Break

If you break after a function call, it means that any If statement after it will not be evaluated. This means that regardless of whether the If statement would be true or not, any statement after the break will not be run. If you do not break, it means that the If statment will be evaluated, so in the If block, more than one statement can be run.