if that "split(',')" is from strutils, it returns seq[string], not tuple. I guess you need to use something like this:
for line in readFile(day02PathAndName):
var data = line.split(',')
if data.len() == 2:
myKey = data[0]
myValue = data[1]
result...
else:
echo "Error in input: ", line
Sorry for being lazy earlier and for my poor English. What I meant was this:
import strutils
var
file = """
Hello,World
Key,Value
"""
for line in file.split("\n"): # iterator returns string
var data = line.split(",") # proc returns seq[string]
# but there is no version of split you can use as "for myKey, myValue in"
if data.len() == 2:
echo data[0]," = ", data[1]
let mySeq:seq[string]=readFile(day02PathAndName).split(',')
for myKey, myValue in mySeq:
result[myKey.int64]=myValue.parseint.int64
for myKey, myValue in readFile(day02PathAndName).split(',').pairs():
result[myKey.int64]=myValue.parseInt