blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 14 Jul 2014 09:11 AM |
my code(not ROBLOX Lua): ~~ io.write("Enter a number from 1 to 10: ") input = io.read()
OG = 7
if input > 10 then print("Please enter a number less than 10 next time!") elseif input < 1 then print("Please enter a number greater than 1 next time!") elseif input == OG then print("Our guess was: " .. OG .. ", you also entered: " .. input .. "!") else print("Our guess was: " .. OG) end ~~
i just do not know. :/ |
|
|
| Report Abuse |
|
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 14 Jul 2014 09:12 AM |
| I'm assuming it's the user's input that is creating the error, but I don't know. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:16 AM |
| You need to convert the input from a string to a number. |
|
|
| Report Abuse |
|
|
Zecrit
|
  |
| Joined: 24 Jan 2013 |
| Total Posts: 2618 |
|
|
| 14 Jul 2014 09:17 AM |
| Can you post what line the error is on because I have a suspicion as to what is wrong. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:18 AM |
| The input automatically thinks it's a string, so you need to convert it to an integer |
|
|
| Report Abuse |
|
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 14 Jul 2014 09:22 AM |
| Well, I'm using an IDE. The IDE didn't show an error. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:24 AM |
| What language is this if I may ask? |
|
|
| Report Abuse |
|
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
| |
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 14 Jul 2014 09:24 AM |
I found the fix anyways. I just converted the user input to a number. :/
~~~~~~~ io.write("Enter a number from 1 to 10: ") input1 = io.read()
input = tonumber(input1)
OG = 7
if input > 10 then print("Please enter a number less than 10 next time!") elseif input < 1 then print("Please enter a number greater than 1 next time!") elseif input == OG then print("Our guess was: " .. OG .. ", you also entered: " .. input .. "!") else print("Our guess was: " .. OG) end ~~~~~~~ |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:27 AM |
| Oh. It's not like I told you twice to do that anyways. |
|
|
| Report Abuse |
|
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 14 Jul 2014 09:28 AM |
OH, I'M SORRY THAT I DIDN'T KNOW HOW TO CONVERT A NUMBER TO A STRING. Smart ass. Why do you think I was asking for help? |
|
|
| Report Abuse |
|
|