Consider some list
list={1.2,1.6,1.8,1.9,2,2.22,3.04,1000};
I would like to check whether some parameter x belongs to the values of the list, and if it does, then return parameter^2, while if it does not, then return 0. Could you please tell me how to do this?
f = Boole@MemberQ[list, #]*#^2 &
$\endgroup$