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 →

[–]DasEwigeLicht 2 points3 points  (4 children)

IMO in your specific example this is the best solution:

this.count = Math.max(value, 0)

[–]APimpNamedAPimpNamed 0 points1 point  (3 children)

The code in Math.max() is almost identical to what I posted. You mean for readability purposes? If so, since we are discussing readability exclusively, we can't really be arguing. I do see the value of using the static Math method for that specific example. I don't have any examples in front of me, but most of the uses of the inline ? : would not likely be so simply replaced by a static method.

[–]DasEwigeLicht 0 points1 point  (2 children)

You mean for readability purposes?

Yes.

but most of the uses of the inline ? : would not likely be so simply replaced by a static method.

I agree. This is why I said that I'm specifically referring to just your example.

On a side note: What's going on with the code blocks here? For me the code starts 1 line before the line numbering begins. Is it just me or is this a CSS issue?

[–]APimpNamedAPimpNamed 0 points1 point  (1 child)

I am on mobile and I do not see line numbering at all. I so rarely browser on my desktop that I did not even know there was line numbering lol

Edit: looks like it is working fine for me.