# Can't understand why

## Recommended Posts

Ok i have a little problem, i made this:

```\$vot = 0
\$x = inputbox("aaa" , "bbb")
\$y = InputBox("aaa" , "bbb")
\$z = abs(\$x - \$y)
Select
Case(\$x < \$y)
\$vot = \$x
Case Else
\$vot = \$y
EndSelect
msgbox(0,"aaa","x=" & \$x & "y=" & \$y & "z=" & \$z & "vot=" & \$vot).```

I need the lower value between xy, and the difference between them. The script works with some numbers but with other numbers not. I would be so glad if i found out why

examples:

\$x = 1000

\$y = 4000

it tells me that \$vot = 1000 which is correct

but if i insert

\$x = 104

\$y = 24

it tells me that \$vot = 104 :|

##### Share on other sites

Just out of curiousity why did you make three threads?

##### Share on other sites

try this:

```\$phrases = StringSplit("less than|greater than|equal to", "|", 2)
\$phrase = \$phrases[0]

\$x = InputBox(@ScriptName, "Enter number x")
\$y = InputBox(@ScriptName, "Enter number y")

\$diff = \$y - \$x
If (\$y < \$x) Then
\$phrase = \$phrases[1]
\$diff = \$x - \$y
ElseIf (\$y = \$x) Then
\$phrase = \$phrases[2]
EndIf

MsgBox(64, @ScriptName, "x(" & \$x & ") is " & \$phrase & " y(" & \$y & "). Difference is " & \$diff)```
Edit: Wow, the 104,24 data screws this up too, hmm, what am i doing wrong..

Edited by smartee

##### Share on other sites

Cause the interpreter dose not know that x and y are numbers .

```\$vot = 0
\$x = Number(inputbox("aaa" , "bbb"))
\$y = Number(InputBox("aaa" , "bbb"))
\$z = abs(\$x - \$y)
Select
Case(\$x < \$y)
\$vot = \$x
Case Else
\$vot = \$y
EndSelect
msgbox(0,"aaa","x=" & \$x & "y=" & \$y & "z=" & \$z & "vot=" & \$vot)```

##### Share on other sites
how did i miss that you are absolutely right.

##### Share on other sites

`Cause the interpreter dose not know that x and y are numbers .`

You gave me a brilliant idea , i added \$x+0 < \$y+0 and it works just fine.

Thanks all for reply, i`ll go back to work , newbie doing stuff... take cover something might blow up

Sry for triple posting, really tired screwed up a bit.

## Create an account

Register a new account

×

• Wiki

• Back

• Git