Question: Logical operatives e.g., [n=2]

Is there any easy way to use logical "operatives"(not sure what they are called)?

 

e.g., x^2[x=3] = if x = 3 then 3^2 or 0

f(x)[g(x)=x^2] = f(x) when g(x)=x^2

or whatever. I don't care about the syntax but would like it to be short and distinct. There are obviously ways to get the same behavior but they are too verbose. I like the bracket syntax but I doubt maple works with it. It could be done with a binary operator that does the comparison and returns if true...

 

But curious if maple has such a thing built in?

Please Wait...