How can I subtract two variables in liquid language?

I am new to shopify and liquid language. I want to substract two variable and show the result. I have {{ product.compare_at_price }} and {{ product.price }} variables. what will be the expression. I tried {{ product.compare_at_price | minus: product.price }} but not worked

Hi,
that is the correct syntax, but make sure that ‘product’ object is accessible.
can you please clarify where you’re using? in which file?