Discuss Scratch

jimhuck
Scratcher
9 posts

appending letters onto a variable

https://scratch.mit.edu/projects/114163582/

If I set the variable message equal to a string like “test”, is there a way to add letters on to the variable? To actually change the value of the variable to, for instance, “testa”?

Thank you for any ideas!

Jim
Extremguy
Scratcher
100+ posts

appending letters onto a variable

you cant concanate a string like this in scratch. The + operator is really only for numbers (int/float whatever) you will need this block to concanate a string for example

(join [(variable)] [some text here])


you are from using python arent you using the .append() . Welcome to Scratch!

Last edited by Extremguy (June 18, 2016 00:00:52)


Extremguy le ptit tannant qui fait des gros petit projets avec Scratch depuis 2012.

Envie de créer tes propres jeux 2d a monde ouvert plus facilement. Viens utiliser dès maintenant mon projet!

crisostimo
Scratcher
500+ posts

appending letters onto a variable

Specifically:

set [Text v] to [test]
set [Text v] to (join (Text) [a])
jimhuck
Scratcher
9 posts

appending letters onto a variable

That's exactly what I wanted! Thank you! Yes, I have been learning Python and have been “appending” a lot!

Powered by DjangoBB