support cstring in case (#20130)
* implement case for cstring for now just converts to string on C backend * custom implementation for cstring * remove leftover * revert even more * add nil + fix packages weird variant literal bug * update docs
This commit is contained in:
parent
1f838d9af1
commit
a95b6391fd
13 changed files with 126 additions and 18 deletions
|
|
@ -1432,6 +1432,8 @@ it can be modified:
|
|||
s[0] = 'u' # This is ok
|
||||
```
|
||||
|
||||
`cstring` values may also be used in case statements like strings.
|
||||
|
||||
Structured types
|
||||
----------------
|
||||
A variable of a structured type can hold multiple values at the same
|
||||
|
|
@ -3098,6 +3100,9 @@ This holds only for expressions of ordinal types.
|
|||
"All possible values" of `expr` are determined by `expr`'s type.
|
||||
To suppress the static error an `else: discard` should be used.
|
||||
|
||||
Only ordinal types, floats, strings and cstrings are allowed as values
|
||||
in case statements.
|
||||
|
||||
For non-ordinal types, it is not possible to list every possible value and so
|
||||
these always require an `else` part.
|
||||
An exception to this rule is for the `string` type, which currently doesn't
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue