proc bodies can be expressions with a type
This commit is contained in:
parent
3ef146b0ea
commit
759b3201ad
12 changed files with 75 additions and 13 deletions
|
|
@ -13,8 +13,11 @@ type
|
|||
valueC,
|
||||
valueD = (4, "abc")
|
||||
|
||||
# test the new "proc body can be an expr" feature:
|
||||
proc getValue: TMyEnum = valueD
|
||||
|
||||
# trick the optimizer with a variable:
|
||||
var x = valueD
|
||||
var x = getValue()
|
||||
echo valueA, ord(valueA), valueB, ord(valueB), valueC, valueD, ord(valueD), x
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue