You should be able to use either. It's all about implementation.
Suppose each level has a number, then you can simply check for globalvariable = level.number and go to that level.
If you want to name the levels, then you can do a similar check: globalvariable = level.name