# Conditional Scalar

Node Description & Purpose:
This node outputs one or two different scalar values based on a comparison between the input value and another value. This is also known as a conditional, because the output value is conditional on the comparison. The basic form of the comparison is this:

if the input value meets the condition of the comparison
output value 1
else (otherwise)
output value 2

There are a number of different comparison methods available. The simplest one is "Equal to". Here's an example of what an "Equal to" comparison looks like:

These are our values -
comparison value is 5
value 1 is 4
value 2 is 8

if the input value is Equal to the comparison value
output value 1
else
output value 2

Now let's say the input value was 5. Following through the above we can see that 5 is equal to the comparison value. That means the node will output value 1, which in this case is 4.

If the input value was 20, which is not equal to 5, then the node will output value 2, or 8 in this example.

As you can see, the node is used for switching between values based on the result of the comparison.

Node Type: Function

Settings:

• Condition: This popup lets you choose the condition, or type of comparison, the node uses. A list of the comparisons follows, along with a short description. It should be taken as read that if the input value does not meet the comparision conditions, then the Else result will be output. Here are the comparisons available:
• Greater than: If the input value is greater than the comparison value the If result will be output.
• Greater than or equal to: If the input value is greater than or equal to the comparison value the If result will be output.
• Equal to: If the input value is equal to the comparison value the If result will be output.
• Not equal to: If the input value is not equal to the comparison value the If result will be output.
• Less than: If the input value is less than the comparison value the If result will output.
• Less than or equal to: If the input value is less than or equal to the comparison value the If result will be output.
• Boolean AND: If the input value and the comparison value are greater than 0 the If result will be output.
• Boolean OR: If the input value or the comparison value are greater than 0 the If result will be output.
• Comparison value: This is the value which the input value is compared with.
• If result: This is the value that the node outputs if the input value meets the comparison. It corresponds to value 1 in the examples above.
• Else result (optional): This is the value the node outputs if the input value does not meet the comparison. It corresponds to value 2 in the examples above. This value is optional. If you don't supply an Else result value then the input value will be output by the node, if it does not meet the comparison.

Error conditions:

• It is an error for there to be no input value. In that case 0 is output from the node.
• It is an error for there to no Comparison value and/or no If result value. In this case the input value is output from the node.

A scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.

A single object or device in the node network which generates or modifies data and may accept input data or create output data or both, depending on its function. Nodes usually have their own settings which control the data they create or how they modify data passing through them. Nodes are connected together in a network to perform work in a network-based user interface. In Terragen 2 nodes are connected together to describe a scene.