ternary operator is possible, seq comprehension in future module, shorthand to array initialization not really possible
This commit is contained in:
parent
247f4226a4
commit
4c705aa63b
|
@ -34,6 +34,7 @@ quickly).
|
||||||
|
|
||||||
- a ternary condition - like ?: in C, or iif()
|
- a ternary condition - like ?: in C, or iif()
|
||||||
- You can do: ``if cond: a else: b``, IIRC the ``?:`` won't make it into Nim.
|
- 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>
|
- <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.
|
- 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
|
- a shorthand initialization of arrays or sequences, eg var x: array[0..25, int] = -1
|
||||||
would initialize all elements of x to -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>
|
- <del>array/sequence comprehension</del>
|
||||||
|
- They are present in the ``future`` module of the standard library.
|
||||||
|
|
||||||
- introspection like python's dir()
|
- introspection like python's dir()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue