I'm trying to declare a dictionary:
var alphanum2Index: Dictionary<Character, Int> = [" ": 0,
"A": 1, "B": 2, "C": 3, "D": 4, "E": 5, "F": 6, "G": 7]
::::
for i in longText
{
oneChar = i
newCode = alphanum2Index[i]
print ("i, newCode: ", i, newCode)
}
longText is a ~300 characters of text, but I get the following error message:
/Users/wayned1/devel/KeyGen2/Testing/testing2/testing2/AppDelegate.swift:95:37 Value of optional type 'Int?' must be unwrapped to a value of type 'Int'
I'd like to use meaningful names instead of data types in the declaration, maybe inChar & index, but right now I'm at a loss. What does "unwrapped" mean in this context?
Also I'm trying to use "fseek"(?) to move around in a file, but for the time being that's on the back burner while I continue with the algorithm development.
I'm also not sure which category this fits in.