Forum Discussion

Komag's avatar
Komag
Roku Guru
11 years ago

Why does this code crash? Just a string variable

	gS = 1 ' Base "Game Speed"
di = CreateObject("roDeviceInfo")
model = di.GetModel()
? model
? Type(model)
fastRokus = ["2400X", "2450X", "3000X", "3050X", "3100X", "4200X", "2700X", "2710X", "2720X"]
slowRokus = ["N1050", "N1000", "N1100", "2050X", "2050N", "N1101", "2100X", "2100N", "2000C"]
FOR EACH roku IN slowRokus
IF model = roku THEN gS = 2
END FOR
? model " is the model"
? "Game Speed set to " gS
? "Roku model " model


It correctly prints:
2050X
String
2050X is the model
Game Speed set to 2

Then it crashes with message: "Use of uninitialized variable" on line ? "Roku model " model

What the heck? I've already used that variable four times before that line, what gives? Does it have something to do with it being a String and not a roString? I believe I've printed strings that way before, but maybe I'm remembering wrong. Why would it work to use "model" first in the print ("2050X is the model"), but not second ("Roku model 2050X")?
No RepliesBe the first to reply