version 0.7.6
This commit is contained in:
parent
e792940f52
commit
08bc9ac03c
29 changed files with 5926 additions and 0 deletions
15
tests/ttempl3.nim
Normal file
15
tests/ttempl3.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
template withOpenFile(f, filename, mode: expr, actions: stmt): stmt =
|
||||
block:
|
||||
var f: TFile
|
||||
if openFile(f, filename, mode):
|
||||
try:
|
||||
actions
|
||||
finally:
|
||||
closeFile(f)
|
||||
else:
|
||||
quit("cannot open for writing: " & filename)
|
||||
|
||||
withOpenFile(txt, "ttempl3.txt", fmWrite):
|
||||
writeln(txt, "line 1")
|
||||
txt.writeln("line 2")
|
||||
Loading…
Add table
Add a link
Reference in a new issue