Equivalent to Python with Statement

Jonathan JonathanILevi at gmail.com
Tue Feb 27 16:17:20 UTC 2018


I know Python's `with` statement can be used to have an automatic 
close action:
```
     with open("x.txt") as file:
         #do something with file
     #`file.close()` called automatically
```

I know D's `with` statement does something different but is there 
some sort of equivalent?


More information about the Digitalmars-d-learn mailing list