Math.Max vs inline if – what are the differences?

One of the major differences I would notice right away would be for readability sake, as far as I know for implementation/performance sake, they would be nearly equivalent.

Math.Max(a,b) is very simple to understand, regardless of previous coding knowledge.

a>b ? a : b would require the user to have some knowledge of the ternary operator, at least.

When in doubt – go for readability

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)