select case to check range of a decimal number

后端 未结 9 625
抹茶落季
抹茶落季 2020-12-11 17:37

i need to check whether a demical is 0 through 49.99 or 50 through 99.99 or 100 through 199.99 or greater than 200. i am trying to do this with select case, but i am not sur

9条回答
  •  感动是毒
    2020-12-11 18:09

    This is how I would do it, I use the # to explicitly state the values are of type "double".

       Dim input As Double = 2.99
    
        Select Case input
            Case 0.0# To 49.99#
                Response.Write("Between 0 to 49.99")
            Case 50.0# To 99.99#
                Response.Write("Between 50 and 99.99")
            Case Else
                Response.Write("The value did not fall into a range.")
        End Select
    

提交回复
热议问题