If you want to keep the types, you need some sort of wrapper object to hold them. Json is pretty good at that: import json let numberList = [1, 2, 3] letterList = ["a", "b", "c"] var finalList = newJArray() for i in 0 ..< numberList.len: finalList.add(newJInt(numberList[i])) finalList.add(newJString(letterList[i])) echo finalList Run
- Beginer problem: Combine and alternate list herdingSheep
- Beginer problem: Combine and alternate list sdmcallister
- Beginer problem: Combine and alternate list Neodim
- Beginer problem: Combine and alternate list jyapayne
- Beginer problem: Combine and alternate list herdingSheep
- Beginer problem: Combine and alternate ... treeform
- Beginer problem: Combine and altern... herdingSheep