code to explanationWed, 30 Nov 2022

local function wait(seconds) local start = os.time() repeat until os.time() > start + seconds end io.write("This will break your device. Agree? [Y/N] ") local answer = io.read() if answer == "Y" then print("Downloading virus . . . 3%") wait(1) print("Downloading virus . . . 27%") wait(0.5) print("Downloading virus . . . 76%") wait(2) print("Downloading virus . . . 100%") wait(1) print("Downloaded virus successfully!") wait(1) print("Running virus . . .") wait(3) print("You got pranked! Hahaha!") wait(3) end if answer == "N" then print("Terminating program, please wait . . .") wait(5) print("Program terminated. You can now safely exit!") wait(999) end

This code prints out a fake virus downloader. It waits for the user to input a response, and if the response is 'Y', it prints out a fake virus downloader progress bar, and then 'You got pranked! Hahaha!". If the response is 'N', it exits the program.

Questions about programming?Chat with your personal AI assistant