-
-
Save Yardanico/a4cee9628999e7ef1d0068e343f18350 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
Maybe = object | |
value: string | |
proc charmatch(input: string): Maybe = | |
# If you replace this line with just input | |
# or something else - it works. | |
result.value = input[0 .. ^1] | |
proc p1(): Maybe = | |
let lresult = charmatch("123;") | |
# The line below is needed - if you use var/let directly in | |
# lvalue, lnext assignment - it works. | |
var lvalue, lnext: string | |
(lvalue, lnext) = (lresult.value, ";") | |
result.value = lvalue | |
proc main = | |
let r1 = p1() | |
doAssert r1.value == "123;" | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment