Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Input only takes strings?

    Help
    2
    3
    183
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • digDug
      digDug last edited by

      So I have this code

      a = input("Number 1", false)
      b = input("Number 2", false)
      
      print("The two numbers added qual ", a + b)
      update()
      sleep(1)
      

      I'm just wondering how I can make it compute 1+1=2 and not 1+1=11
      Does input only take strings?
      Should I be using getkeyboardBuffer()?

      pianofire 1 Reply Last reply Reply Quote 0
      • pianofire
        pianofire Fuze Team @digDug last edited by pianofire

        @digdug Yes it does but you can cast the result

        so something like

        a = int(input("Number 1", false))
        

        You could also use getkeyboardBuffer to read the keyboard input yourself

        1 Reply Last reply Reply Quote 2
        • digDug
          digDug last edited by

          @pianofire I was doing the int wrong. Thank you!

          1 Reply Last reply Reply Quote 1
          • First post
            Last post