summary refs log tree commit diff stats
path: root/tests/stdlib/tstreams.nim
blob: 640565a275ebf7cc68a8920a6aead8c098a8b2d0 (plain) (blame)
1
2
3
4
5
6
7
import streams

var outp = newFileStream(stdout)
var inp = newFileStream(stdin)
write(outp, "Hello! What is your name?")
var line = readLine(inp)
write(outp, "Nice name: " & line)
al.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# bug #5135
proc fail*[E](e: E): void =
  raise newException(Exception, e)

# bug #4875
type Bar = object
    mFoo: int

template foo(a: Bar): int = a.mFoo

proc main =
    let foo = 5 # Rename this to smth else to make it work
    var b: Bar
    echo b.foo

main()