Merge pull request #1075 from flaviut/inlinedocs
Add some documentations and code examples in system
This commit is contained in:
commit
a690e7b267
71 changed files with 2521 additions and 15 deletions
41
tests/misc/tvarious1.nim
Normal file
41
tests/misc/tvarious1.nim
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
discard """
|
||||
file: "tlenopenarray.nim"
|
||||
output: '''1
|
||||
0
|
||||
Whopie
|
||||
12'''
|
||||
"""
|
||||
|
||||
echo len([1_000_000]) #OUT 1
|
||||
|
||||
type
|
||||
TArray = array[0..3, int]
|
||||
TVector = distinct array[0..3, int]
|
||||
proc `[]`(v: TVector; idx: int): int = TArray(v)[idx]
|
||||
var v: TVector
|
||||
echo v[2]
|
||||
|
||||
# bug #569
|
||||
|
||||
import queues
|
||||
|
||||
type
|
||||
TWidget = object
|
||||
names: TQueue[string]
|
||||
|
||||
var w = TWidget(names: initQueue[string]())
|
||||
|
||||
add(w.names, "Whopie")
|
||||
|
||||
for n in w.names: echo(n)
|
||||
|
||||
# bug #681
|
||||
|
||||
type TSomeRange = object
|
||||
hour: range[0..23]
|
||||
|
||||
var value: string
|
||||
var val12 = TSomeRange(hour: 12)
|
||||
|
||||
value = $(if val12.hour > 12: val12.hour - 12 else: val12.hour)
|
||||
echo value
|
||||
Loading…
Add table
Add a link
Reference in a new issue