Hi,
How to put # 10 times in one line?
I’ve tried to use, but it doesn’t work ok:
:for i from=1 to=10 do={
:put "# \r"
}
Hi,
How to put # 10 times in one line?
I’ve tried to use, but it doesn’t work ok:
:for i from=1 to=10 do={
:put "# \r"
}
You could collect those in a variable, and just output the variable at the end, e.g.
:local line “”;
:for i from=1 to=10 do={
:set line ($line . “#”);
}
:put ($line . “\r”);
Thank you. Someone else helps me.
Other script, make this same:
:global cache “”
:for i from=1 to=10 do={
:global cache “$cache#”
}
:put $cache
You need to use “:set” instead of “:global” to modify a variable.
If the variable is supposed to persist between script runs, you’ll want to remove the default value, i.e.
:global cache
:for i from=1 to=10 do={
:set cache ($cache . “#”)
}
:put $cache
Yet one question.
:local limitA “1000”;
:local list “limitA”;
:put (“$” . $list);Why does this script return $limitA instead of 1000? What is bad in this script?
What “:put” does is to output a string. No special interpretation is done on it.
If you want to get the value of a variable, you write the variable - you don’t write a string containing the name of the variable, i.e. just
:put $limitA;If you want to have a string be interpreted as a scripting code, you can use the “:parse” command, but it can be somewhat buggy at times (for some reason, an otherwise syntactically valid code written out as a string, passed to :parse, fails at my version).
Thanks. Also I had a problem with :parse. It returns $(code). Now I use if, instead.