Send to Printer

st4u

ST 4U 396: Money in VA Smalltalk

May 31, 2013 11:28:33.023

Today's Smalltalk 4 You looks at money data in Smalltalk. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube. To watch now, click on the image below:

Money.

If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.

You can also watch it on YouTube:


When you deal with monetary amounts, you really should not use floating point numbers. In VA Smalltalk, there's AbtMoney:


one := 3.54 abtAsMonetaryAmount.
two := 2.12 abtAsMonetaryAmount.

one + two an AbtMonetaryAmouny

If you try the above code, you'll find that you can do standard arithmetic with money objects. If your applicatio deals with financial data, use this instead of floating point :)

Need more help? There's a screencast for other topics like this which you may want to watch. Questions? Try the "Chat with James" Google gadget over in the sidebar.

Tags: ,

Enclosures:
[st4u396-iPhone.m4v ( Size: 1310467 )]

posted by James Robertson

 Share Tweet This