https://kotlinlang.org logo
#codereview
Title
# codereview
e

Eugen Martynov

12/02/2019, 3:38 PM
Is there more idiomatic way to write
Copy code
editText.length() in 2 until maxEditLength
?
Maybe at least
Copy code
editText.length() in (2 until maxEditLength)
b

Burkhard

12/02/2019, 4:45 PM
IMO it’s much easier to read with the parenthesis. Also I would consider using
editText.size
instead of
editText.length()
but I guess that is up to personal preference as long as it is consistent within the project/team.
a

arekolek

12/03/2019, 6:29 AM
so if
editText.length()
is 6 and
maxEditLength
is also 6, you want the condition to return
false
? that’s a bit confusing why not make
maxEditLength
inclusive and use
editText.length() in 2..maxEditLength
?
e

Eugen Martynov

12/03/2019, 4:27 PM
@arekolek thank you for the finding bug!
👍 2
4 Views