Created
June 23, 2017 18:17
-
-
Save mppf/76ab372f86c36cbb8a7c22647ff1fa62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
record R { | |
var x: int; | |
proc deinit() { | |
writeln("Destroying ", x); | |
} | |
} | |
proc foo() { | |
var count = 0; | |
do { | |
writeln("creating 1"); | |
var one = new R(1); | |
break; | |
writeln("creating 2"); | |
var two = new R(2); | |
count += 1; | |
} while count < 2; | |
} | |
foo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Even simpler: