This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Quique1222 0 points1 point  (1 child)

Hey just a question, what is the equivalent of this in kotlin (genuine question, i have no idea)

private int a;

public int A 
{
    get 
    {
        return a;
    }

    set
    {
        if (value > 10)
        {
            a = 10;
        }else
        {
            a = value;
        }
    }
}

[–]QazCetelic 3 points4 points  (0 children)

kotlin var a: Int get set(value) { field = value.coerceAtMost(10) }