Fallen_Stress Posted November 27, 2020 Share Posted November 27, 2020 Hi guys I need your help for someone important. How can i compare any integer number to a negative number. i am using a prompts input i dont want the user to input a negative number so i want to bock all negative numbers. if Currencies[1] < 0 then gg.alert(" Negative number are not allowed. Please try again with a positive numbers") Currencies() return end end Link to comment Share on other sites More sharing options...
MonkeySAN Posted November 27, 2020 Share Posted November 27, 2020 try if this work... if tonumber(Currencies[1]) < 0 then gg.alert(" Negative number are not allowed. Please try again with a positive numbers") Currencies() return end end Link to comment Share on other sites More sharing options...
Fallen_Stress Posted November 27, 2020 Author Share Posted November 27, 2020 what is the use of tonumber ? Link to comment Share on other sites More sharing options...
MonkeySAN Posted November 27, 2020 Share Posted November 27, 2020 for comparing number im guess... in this case..your input Currencies[1] to 0..if less than 0 (< 0) then script return but im no expert. Link to comment Share on other sites More sharing options...
Fallen_Stress Posted November 27, 2020 Author Share Posted November 27, 2020 Thanks Link to comment Share on other sites More sharing options...
Question
Fallen_Stress
Hi guys I need your help for someone important.
How can i compare any integer number to a negative number.
i am using a prompts input i dont want the user to input a negative number so i want to bock all negative numbers.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.