Can you tell me how the expression
Math.min(params.max ? params.int('max') : 10, 100)
works? It doesn’t fit the groovy ternary if, so what special operator is this?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Perhaps breaking it up into two expressions would help.
params.max ? params.int('max') : 10is the ternary expression…the result of which ends up being the first arg toMath.min(with100being the other arg).Looks like the end result is an integer that’s limited to being at most 100, and defaults to 10.