Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import strutils
- proc test[T](val: seq[T]) =
- echo "Sequence type $#..$#" % [$val.high, $val.low]
- proc test[T](val: T) =
- echo "Primitive type $# bytes" % [$val.sizeof]
- proc test[T](val:openarray[T]) =
- echo "Array type $#..$#" % [$val.high, $val.low]
- var a: int = 4
- var b: seq[int] = @[0,1,2,3,4,5,6,7]
- var c: array[0..10, int]
- when isMainModule:
- echo "A"
- test(a)
- echo "B"
- test(b)
- echo "C"
- test(c) # "Primitive type 88 bytes"
Advertisement
Add Comment
Please, Sign In to add comment