Explain why you cannot convert the following If...Then ...ElseIf statement into a Select Case statement: If dblTemperature = 100 Then intX = 0 ElseIf intPopulation > 1000 Then intX = 1 ElseIf dblRate < .1 Then intX = -1 End If
1.In simple words we can say that the main reason for which it cannot be converted to select case statement because it contains multiple and different conditions.
2. Select case statement is used to test the equality of a statement having a single conditional expression, after which based on the result the execution goes to the part of the suitable match.
3. In the given question, there are three different comparisons each for temperature, population and rate. Thus if else statement can be used which will keep on checking the condition one after another and finally assign a value to the variable intX based on the true statement.
Get Answers For Free
Most questions answered within 1 hours.