Experimentation
This commit is contained in:
@@ -19,4 +19,3 @@ if [ "$answer" = yes ]
|
|||||||
fi
|
fi
|
||||||
echo "Exiting"
|
echo "Exiting"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
26
lua/randTestExperiment.lua
Normal file
26
lua/randTestExperiment.lua
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
-- Assistance from a friend
|
||||||
|
|
||||||
|
-- Instantiate all the things
|
||||||
|
local run = true
|
||||||
|
local cmd, number, randnum
|
||||||
|
|
||||||
|
-- Start a loop
|
||||||
|
while run == true do
|
||||||
|
-- Get the users initial number
|
||||||
|
io.write("Pick a number: ")
|
||||||
|
number = io.read("*n")
|
||||||
|
|
||||||
|
-- Do some mathemagic
|
||||||
|
-- randnum = math.random(1, number)
|
||||||
|
print("The random number is ", math.random(1, number))
|
||||||
|
|
||||||
|
-- Ask to rerun script
|
||||||
|
io.read()
|
||||||
|
print("Run again (Y/n)?")
|
||||||
|
cmd = io.read("*l")
|
||||||
|
|
||||||
|
-- Exit if the user doesn't want to go again
|
||||||
|
if string.lower(cmd) ~= "y" then
|
||||||
|
run = false
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -7,12 +7,12 @@ local cmd, number, randnum
|
|||||||
-- Start a loop
|
-- Start a loop
|
||||||
while run == true do
|
while run == true do
|
||||||
-- Get the users initial number
|
-- Get the users initial number
|
||||||
print("Pick a number: ")
|
io.write("Pick a number: ")
|
||||||
number = io.read("*n")
|
number = io.read("*n")
|
||||||
|
|
||||||
-- Do some mathemagic
|
-- Do some mathemagic
|
||||||
randnum = math.random(1, number)
|
randnum = math.random(1, number)
|
||||||
print("The number is ", randnum)
|
print("The random number is ", randnum)
|
||||||
|
|
||||||
-- Ask to rerun script
|
-- Ask to rerun script
|
||||||
io.read()
|
io.read()
|
||||||
|
|||||||
Reference in New Issue
Block a user