Apply block to scalar depending on if the scalar is defined.