@Araq Nice riposte. By the way: I never noticed {} is a valid multi-argument
operator, actually! It looks a little... unnimish. ^^"
@Araq, English is not my native language. When I started programming as a
child, my all English knowledge was consisting of "What is this? This is a
pencil" So I learned programming by reading and tinkering other people's code
and learned English by trying to understand programming manuals, all
Thank you guys !
@mratsim, off topic:
[https://twitter.com/DeepMindAI/status/920696139657240576](https://twitter.com/DeepMindAI/status/920696139657240576)
Cool !!
[https://nim-lang.org/docs/json.html#dynamically-retrieving-fields-from-json](https://nim-lang.org/docs/json.html#dynamically-retrieving-fields-from-json)
> To retrieve the value of "key" you can do the following:
>
> doAssert jsonNode["key"].getFNum() == 3.14
>
> The [] operator will raise an e
Issue raised here:
[https://github.com/nim-lang/Nim/issues/6531](https://github.com/nim-lang/Nim/issues/6531)
Remember, with 4 PRs this month, you get a Hacktoberfest shirt
Ironically, it is newbies who recognize what is missing.
Add a **PR** as you learn, so others can benefit. It also gets you familiar
with contributing to Nim.
There have been many suggestions of a **cookbook** for easy cut and paste of
example code. It hasn't really gained traction, unfortunate
@sky_khan, I agree with you. The more examples the better!
I am also learning Nim ... one of the main problems I had (and I have) is
precisely the absence of examples in the documentation.
In addition, I would kindly ask a favor for the older staff - please create
more examples in the documenta
hmm, couldnt see that coming. I partly blame documentation. I wish It was
categorized by purpose. Not stacks of procs, templates, macros but
constructors/initializers, destructors, getters, setters, (for json module)
parsing etc. More examples would not be bad either.
field1 = jz{"node1"}.getStr
I'm learning Nim myself by trying to write this, seems working
import json
var field1, field2, field3 : string
var jz : JsonNode = %* {"node1": "Node1Value","node3":nil}
template nodeAsStr(n:JsonNode,key:string,default:string="*NoValue*"):
string =
if n!=n
Hi, please consider the code below.
import json
var field1, field2, field3 : str
var jz : JsonNode
field1 = jz["node1"].getStr
field2 = jz["node2"].getStr
field3 = jz["node3"].getStr
Sometimes the nodes node1, node2 and/or node3 are available at my
11 matches
Mail list logo