In production code I would simply write 1 <= x && x <= 100 With these two helpers in place and assuming that if any number can be cast as a double without the required accuracy. // handle outside of range logic @na9er 5.5 is outside the range according to the code you posted. @Ben: I went on the subject, which says "within a range" (which I don't think is ambiguous in that regard), but you're right in that the question body says "between 1 and 100" (which is, of course, ambiguous). Cannot find much material on suggestions on style of conditions for the Requires and other related Code Contract methods. When using targets which execute discrete instructions sequentially (typical in the embedded world), however, generating optimal code may require knowing the distribution of input cases in ways that a programmer might and a compiler can't. For query 1: the number 1 is not present in any of the range. Better way to check if an element only exists in one array. How do I parse a string to a float or int? In general you should wrap all floating point numbers in what is called a 'epsilon ball' this is done by picking some small value and saying if two values are this close they are the same thing. For example, if range is [10, 100] and Steps: Go to the Developer Tab >> Visual Basic Option.