1st question

for the code, I expected the latter output is 
    
    
    21
    HELLO
    
    
    Run

however, the real one is 
    
    
    21
    
    20
    HELLO
    20
    
    
    Run

why `20` appears?

the code 
    
    
    import strUtils
    import json
    
    var a = %*[1, "hello", nil]
    
    echo a
    echo "\n"
    
    for i in a.items():
        echo i, " ", i.type
    echo "\n"
    
    for i in a.items():
        if i.getInt() is int:
            echo (i.getInt() + 20)
        if i.getStr() is string:
            echo i.getStr().toUpper
    
    
    Run

Reply via email to