input a number, with input() ???

Just starting out? Need help? Post your questions and find answers here.
spiral72
User
User
Posts: 16
Joined: Thu Feb 17, 2011 8:34 pm

input a number, with input() ???

Post by spiral72 »

I'm trying to use input() to accept a number from the keyboard. It doesn't work since this is a string instruction.


Is there another version if input() that will accept a number?? Or is there a work-around???

My searches come up with nothing. :(
spiral72
User
User
Posts: 16
Joined: Thu Feb 17, 2011 8:34 pm

Re: input a number, with input() ???

Post by spiral72 »

Actually, more correctly, I "CAN" type a number in for the input() entry, but it's just a string which happens to contain numeric digits.

It'd be real nice if I could, something like:

a = input()
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: input a number, with input() ???

Post by ts-soft »

Code: Select all

If OpenConsole()
  Print("Number please: ")
  Number = Val(Input())
  Debug Number
EndIf
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
spiral72
User
User
Posts: 16
Joined: Thu Feb 17, 2011 8:34 pm

Re: input a number, with input() ???

Post by spiral72 »

AH! Thank you! It works perfectly :)


and thank you for the fast response.
Post Reply