comparison samples/file.tp @ 297:abe3141caefe

Added file module and sample
author Michael Pavone <pavone@retrodev.com>
date Thu, 24 Jul 2014 23:53:54 -0700
parents
children
comparison
equal deleted inserted replaced
296:2a0a88799737 297:abe3141caefe
1 #{
2 import: [
3 stdin
4 stdout
5 ] from: file
6 main <- {
7 stdout write: "Hello from the file module!\nWhat's your name?\n"
8 name <- (stdin nextLine) trim
9 stdout write: "Nice to meet you " . name . ". Here's my source code:\n\n"
10 f <- file open: "samples/file.tp"
11 foreach: (f lines) :num text {
12 print: (string: num+1) . ": " . text
13 }
14 print: "\n"
15 f close
16 0
17 }
18 }