len.xgo 211 B

123456789101112131415
  1. os := import("os")
  2. fmt := import("fmt")
  3. sjson := import("cjson")
  4. dec := cjson.new_decoder("<stdin>")
  5. //file_path := args[0]
  6. n := 0
  7. for {
  8. v := dec.decode()
  9. if !v {break}
  10. n++
  11. fmt.println(n)
  12. }
  13. fmt.println(n)