Join Slack
Powered by
Does using a range in a boolean context instantiat...
# codingconventions
j
Jonathan Ellis
07/26/2022, 5:17 PM
Does using a range in a boolean context instantiate an IntRange object, or is the compiler smart enough to avoid that?
e
ephemient
07/26/2022, 5:22 PM
as long as it is written like that (and not
val range = 1..12; return month in range
), then the compiler does not create the IntRange and produces code equivalent to the first
j
Jonathan Ellis
07/26/2022, 5:23 PM
thanks!
3
Views
Open in Slack
Previous
Next