+ 1

What will happened if we write 2 times file.close() statement?

29th Mar 2016, 3:45 PM
Dinesh Ingole
Dinesh Ingole - avatar
5 Answers
+ 3
Just try it and you will know what will happen!
22nd Jun 2016, 11:26 AM
ę›¾ä¹ęˆ
ę›¾ä¹ęˆ - avatar
+ 3
There whould be an error, because when you close file the object associated with this file will be deleted from memory. The second call of file.close will result in error: object file does not exist.
2nd Jul 2016, 9:05 AM
ŠŠ»ŠµŠŗсŠµŠ¹ ŠšŠ»Š¾Ń‡ŠŗŠ¾Š²
ŠŠ»ŠµŠŗсŠµŠ¹ ŠšŠ»Š¾Ń‡ŠŗŠ¾Š² - avatar
+ 2
I do not think that anything wrong would happen. As the file is already closed, the close() statement will not do anything.
23rd May 2016, 10:35 AM
James Flanders
0
i think its better you try ut yourself when statement is work in a single pharntases why u close it twise
13th Jun 2016, 10:28 AM
Iman Ali
Iman Ali - avatar
0
Either nothing or it'll return an error, try it yourself to know for sure or check documentation
1st Jul 2016, 8:58 PM
Azriel Gridfen
Azriel Gridfen - avatar