Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // I've tried:
- var fos: FileOutputStream?;
- for (...) {
- if (condition met) {
- if (fos == null) { // compiler error: not initialized
- fos = FileOutputStream(filename);
- }
- }
- fos.write(something)
- }
- // Also this
- var fosCreated: Boolean = false;
- var fos: FileOutputStream?;
- for (...) {
- if (condition met) {
- if (!fosCreated) { // compiler error: not initialized
- fos = FileOutputStream(filename);
- fosCreated = true;
- }
- fos.write(something)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement