For curves there is a very simple notion of degree of a line bundle or equivalently of a Weil or Cartier divisor. Even in any projective space $\mathbb P(V)$ divisors are cut out by hypersurfaces which are homogeneous polynomials of a certain degree.

Is there a more general notion of degree that applies to schemes with less structure?

Also, say you have a nice enough scheme $X$ so line bundles correspond to Cartier divisors under linear equivalence. In whatever the most general setting is so that the degree of a line bundle makes sense, is there an example of a line bundle $L \ne O_X$ that is degree 0 and has $h^0(L$) = 1?