Jump to content

Number() Does not solve my equation.


Rad
 Share

Recommended Posts

$w = Number(1+2+10) ;returns 13

$x = Number("3.14") ;returns 3.14

$y = Number("24/7") ;returns 24

$z = Number("tmp3") ;returns 0

umm, right... I'm making a basic calculator for a demonstration for my friend. But what the hell?! If you press + it sets "$method[$currentmethod]" to +. Now, it has to be a "+" or else I get a syntax error. Now when I put $value[1] & $method[1] & $value[2] etc together it turns the mass into a string, then returns the first value. If I display the equation its all fine, but doesnt seem to work for as an equation... Is there any functionst to solve? Maybe I overlooked I checked the helpfile theres none like Equation() or Solve()...:/

Link to comment
Share on other sites

  • Moderators

$test = Number(24/7)
$test2 = Int(24/7)
MsgBox(0, 'test', "If you don't have it in a string you get this: (" & $test & ")" & @CRLF & "Or you could simply make it an integer like this Int(24/7) if you don't want decimals (" & $test2 & ")")

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hmm, that doesnt quite help because it makes it a string as I add every 'method' (+, -, *, /) to the equation...

And it takes the first number/int if its a string :o

(Another word for 'number' is real idk why it does have a real() function ;P)

Edited by Rad
Link to comment
Share on other sites

  • Moderators

Can you provide a real code... what your actually doing? What returns a 'literal string'?

Edit:

You'll need beta for this:

$test = Execute("24/7")
MsgBox(0, 'test', "(" & $test & ")")
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...