How to print characters from "a" to "z" using for loops

for i = 97, 122 do
	print(string.char(i)) -- prints "a" to "z"
end

97 is the ascii representation of a and 122 is the representation of z so we are looping through those 2 numbers and getting character using string.char()

for i = 65, 90 do
	print(string.char(i)) 
end
-- 65 is A and 90 is Z

and running this script will print alot of things into the output :arrow_down_small:

local str = ""
local i=0
while true do
	if i > 255 then break end
	str = str .. " " .. string.char(i)
	i+=1
end

print(str)

  • was this uselss?
  • yes
  • no
  • of course

0 voters

2 Likes