Leonid provides a nice method for doing this within "pure functions" but I think it should be pointed out that the common method for doing this is pattern matching.
For example:
f[a_, {i_, j_}] := a == 0 || Abs[i - j] <= 1 triDiagonalQ[mat_] := And @@ Flatten @ MapIndexed[f, mat, {2}] Or:
triDiagonalQ[mat_] := And @@ Flatten @ MapIndexed[#2 /. {i_, j_} :> # == 0 || Abs[i - j] <= 1 &, mat, {2}]