Hello, i have one beginners problem:
pomPrice := (item value / 100) * item price.
Transcript show: 'Price is: '; show: pomPrice; cr. result: Price is: (1999/20) item value is 5 item price is 1999
but i need value = number :)
thnx
Hi,
asFloat, asInteger, rounded, truncated...
In your case I guess asFloat...
Also, in your operation that lead to a fraction, if you declare a number as a float (but smalltalk way, you write it), the evalutaion will result in a float...
(1999/20.00) "print it" instead of (1999/20.00)
so (item value / 100.00) for instance...
Cheers, Cédrick
Another approach:
Transcript show: 'Price is: '; show: (pomPrice printShowingDecimalPlaces: 2); cr.
beginners@lists.squeakfoundation.org