Using a String in a Calculated Indicator

In this example, the value of a numeric indicator is calculated using a different formula, depending on the value of a input (called StringInput). This calculation has two inputs:
If the value of StringInput is “Normal”, then the value of the indicator is set to the value of Input1. On the other hand, if the value of StringInput is “Squeaking”, then the value for the indicator is set to twice the value of Input1. Finally, if the value of StringInput is “Worn out”, then the value of the indicator is set to three times the value of Input1.
For example:

VB.NET

If StringInput = “Normal” Then
Return Input1
Elseif StringInput = “Squeaking” Then
Return Input1 * 2
Elseif StringInput = “Worn Out” Then
Return Input1 * 3
End If
Return 0

C#

if (StringInput == “Normal”)
{
return Input1;
}
else if (StringInput == “Squeaking”)
{
return Input1*2;
}
else if (StringInput == “Worn Out” Then
{
return Input1*3;
}
return 0;