When I attempt to use elseif, it doesn\'t work. In the case of the code below, no matter which number the user inputs, the only code that runs is the code under
elseif
The problem is not with the elseif. The problem is because io.read() returns a string. Either convert it to a number:
io.read()
pref = tonumber(io.read())
Or, compare pref with "1", "2" instead.
pref
"1"
"2"