Improved range function

Range function now works more like the JS version, accepting an array or varargs of strings. Also changed the loop logic thanks to @ryansmith94