How to declare a "global" variable to be used across the script

Hi,

I want to declare a few variables that could hold a string for example, so that I can just type that variable in any code block without having to type the whole string every time. Is this possible, and if so, how?

Simply, in a code block somewhere…

def st1()
{
return=“Really long string i don’t want to type each time”;
};

Then use st1() in the code blocks throughout your script.

Have you looked at the design script language guide here :wink: plenty of good tips in there.

https://www.google.co.nz/url?sa=t&source=web&rct=j&url=http://dynamobim.org/wp-content/uploads/forum-assets/colin-mccroneautodesk-com/07/10/Dynamo_language_guide_version_1.pdf&ved=2ahUKEwi1h-zyso7ZAhWHLpQKHdTSDMEQFjACegQIExAB&usg=AOvVaw0ZCPyEz4ntO9i_nzsJbOGI

1 Like

Thanks! I should really go through all the design script basics one of these days.

2 Likes