Structured text implementation varies by platform, ranging from the pretty bad (Rockwell Studio 5000) to excellent (B&R Automation Studio 3.X and up). Codesys is in the middle, with 2.x being pretty bad and 3.x being okay.
In each one, syntax and rules are all a little different since the IEC spec is pretty lax on required features and whatnot. You're best off opening a sample program for whatever platform you use. I know Shcneider/Elau, B&R and Rockwell all have sample programs freely available, either installed when you install the platform or from their websites.
EDIT: Decent guide on defining variables:
http://www.infoplc.net/files/descargas/rockwell/infoplc_net_plc_st.pdf