Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209
Posted: 03:23pm 18 Jun 2017
Copy link to clipboard
Print this post
Still think using STR$() is the easiest and most straightforward way of getting values to align. This function will right align values and pad with spaces in the front basically doing the formatting for you without the need to know exactly on which line (y) and position (x) you are. at$(x,y) requires you to keep track of the current line also which is a pain. Imagine having more then a screen full of data. With a terminal program that is not a problem as it is basically an infinite large number of lines. Or inserting a line will require you to adjust all then at$(x,y) or alternatively you need to keep track of it programmatically which is just unnecessary clutter.
The problem arises only when STR$() is used when you need to align left instead of right. A LEFT$() will solve that.
What is missing id the PRINT USING statement. This allows formatting. However STR$() does the job adequate enough except for left aligning a numeric value while still having a fixed width (padding spaces to the right). Microblocks. Build with logic.