Avoid non nil checks in examples

`f = File.open('testfile')` is not boolean, so avoid non-`nil` checks. Also keep line length to 80.