N
newbie
I have a script given to me by a co-worker to convert into VB; I can get
the same results but I cannot fully understand the logic here... can
someone please help me write this in a more "understandable" way:
(d += m < 3 ? y-- : y - 2, Math.floor(23 * m / 9) + d + 4 + Math.floor(y
/ 4) - Math.floor(y / 100) + Math.floor(y / 400)) % 4;
I am happy with the major part of the maths, with the mod4, the "then"
and "else" expressions so its just the "if" part I need to "explained"...
(d += m < 3 ? THEN : ELSE, MATH_EXPRESSION) mod4;
Does the "if" part say:
d = d + m;
if(d < 3, then, else)
How does the operator precedence work here? Isn't greater-than,
less-than a higher precedence than += ? In which case:
d = d + (m < 3);
if(d, then, else)
???? or am I missing something ????
the same results but I cannot fully understand the logic here... can
someone please help me write this in a more "understandable" way:
(d += m < 3 ? y-- : y - 2, Math.floor(23 * m / 9) + d + 4 + Math.floor(y
/ 4) - Math.floor(y / 100) + Math.floor(y / 400)) % 4;
I am happy with the major part of the maths, with the mod4, the "then"
and "else" expressions so its just the "if" part I need to "explained"...
(d += m < 3 ? THEN : ELSE, MATH_EXPRESSION) mod4;
Does the "if" part say:
d = d + m;
if(d < 3, then, else)
How does the operator precedence work here? Isn't greater-than,
less-than a higher precedence than += ? In which case:
d = d + (m < 3);
if(d, then, else)
???? or am I missing something ????