Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function GetName()
- write("Enter a name: ")
- return read()
- end
- local Name1 = GetName()
- local Name2 = GetName()
- local Name3 = GetName()
- local Name4 = GetName()
- local Name5 = GetName()
- write("You have entered "..Name1.." "..Name2.." "..Name3.." "..Name4.." "..Name5)
- -- The For Loop
- for i=1,10 do
- print("i is "..tostring(i))
- end
- -- Interactive For Loop
- write("How many times should I loop?")
- local Num = tonumber(read())
- for i=1,Num do
- print("Looped "..tostring(i).." times.")
- end
- -- Simplified First Script
- local string = ""
- for i=1,5 do
- write("Enter a name: ")
- string=string.." "..read()
- end
- write("You have entered "..string)
- -- The While loop
- local Answer, Correct = "", "2"
- while Answer ~= Correct do
- write("What is the sum of 1 and 1 (1+1)? ")
- Answer = read()
- if Answer == Correct then print("Correct!") else print("Incorrect!") end
- end
- -- The Repeat Loop
- local i = 1
- repeat
- print(i)
- i = i + 1
- until i == 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement