Help with formula

Hi, I have the following issue
I need to join two if with 1 and.

The cases that work separately would be.

if(val1=val2, “ok”, “nok”)
if(val1<>0, “ok”, “nok”)

I need to nest them with an And

How can I do it?