I had a very busy year: first doing protein-structure predictions 60 hours a week for the CASP8 competition last summer, then writing papers, writing grant proposals, and teaching during the school year. I'm finally getting a bit of break this summer, and I'll be teaching a short Scratch class to middle-school and high-school students, so I felt I ought to get up to date with the latest version of Scratch.
Displaying numbers with string joins.
This program has a single sprite called digit, which responds to messages print_number, and print_scientific. It uses two input variables, print_after_decimal and print_number, and one output variable, display_out.
When print_number is broadcast, number in print_number is displayed as a string in display_out, with fixed point notation.
This version can print up to 15 places to the right of the decimal point, controlled by print_after_decimal.
When print_scientific is called, the number is displayed in "scientific" notation, with a power of 10 after the letter E (unless the exponent is 0, then the output is the same as print_decimal).
After the call, print_number is 0.
There is a simple test script on the stage:
clicking on s broadcasts print_scientific, d broadcasts print_number, while space clears the display.
The scripts are in a sprite to make them easier to move to another project, and to hide some local variables.
Comments
You need to be logged in to post comments
Add a Comment
I see you're back! I met you at the SC science fair.
Hey! Where have you been?
I had a very busy year: first doing protein-structure predictions 60 hours a week for the CASP8 competition last summer, then writing papers, writing grant proposals, and teaching during the school year. I'm finally getting a bit of break this summer, and I'll be teaching a short Scratch class to middle-school and high-school students, so I felt I ought to get up to date with the latest version of Scratch.
(view all replies)Wow! Favorite!
very usefull project!
wow... I don't think I get it