ternary operator is possible, seq comprehension in future module, shorthand to array initialization not really possible

This commit is contained in:
Misha Kotwica 2017-09-22 19:33:21 +02:00
parent 247f4226a4
commit 4c705aa63b
1 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,7 @@ quickly).
- a ternary condition - like ?: in C, or iif()
- You can do: ``if cond: a else: b``, IIRC the ``?:`` won't make it into Nim.
- A user-defined ternary operator is entirely possible (and really simple).
- <del>a simple way of indexing the last element of an array or sequence, to avoid long-hand code like ``arr[arr.len-1]``</del>
- You can do: ``arr[arr.high]`` or ``arr[arr.low]`` for indexing the last and first element or an array or sequence.
@ -43,8 +44,10 @@ quickly).
- a shorthand initialization of arrays or sequences, eg var x: array[0..25, int] = -1
would initialize all elements of x to -1
- Not possible until result type overloading and result-type generic match is introduced to the language.
- <del>array/sequence comprehension</del>
- They are present in the ``future`` module of the standard library.
- introspection like python's dir()