Hi Tab,

Your script returns 375.10 with 10 as the itemWeight parameter. 
Perhaps, you miss '=' operator (meaning less than or EQUAL) in your
'if...then' statement.
_____
Tab Julius wrote:
> So if itemWeight is 10, then the answer would be 275
...
> on findPrice itemWeight
>    weights =[.5, 1, 1.5, 2, 5, 10, 15, 20]
>    prices =[49.00, 63.70, 78.35, 93.00, 165.45, 275.00, 375.10, 468.45]
>    numRanges =count(weights)
>    repeat with x=1 to numRanges
>      if (itemWeight < weights[x]) then
>        itemPrice =prices[x]
>        return(itemPrice)
>      end if
>    end repeat
>    -- Either return 0, or return a maximum price, or whatever you
>    -- need to do when it's outside the range.
>    return(0)
> end

Also, you may simplify your script with using 'findPosNear' function.

on findPrice2 itemWeight
  weights =[.5, 1, 1.5, 2, 5, 10, 15, 20]
  weights.sort()
  prices =[49.00, 63.70, 78.35, 93.00, 165.45, 275.00, 375.10, 468.45]
  itemPrice =prices[weights.findPosNear(itemWeight)]
  return(itemPrice)
end

Good luck,

Fumio Nonaka
Attain Corporation
Phone: +81-3-3255-4941
Fax: +81-3-3255-5998
mailto:[EMAIL PROTECTED]
http://www.attainj.co.jp

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to