Sign in to follow this  
Followers 0
k1die

Can't understand why

6 posts in this topic

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 this post


Link to post
Share on other sites



Just out of curiousity why did you make three threads?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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 this post


Link to post
Share on other sites
:unsure: how did i miss that :> you are absolutely right.

Share this post


Link to post
Share on other sites

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

You gave me a brilliant idea :unsure:, 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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0