Can I check if value is in range in a guard clause

How about something like this?

def guess(actual, min..max) when actual < min or actual > max

Guards are very limited, and much of the fancy properties of in in guards is done at compile time using macros; because of this a compile time range literal can be used, but a runtime range value cannot.

3 Likes