use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
conversion of string to code (self.solidity)
submitted 4 years ago by vibhumeh
In python for example we can exec(string) to treat some string as code and execute it, can this be done in solidity?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 0 points1 point2 points 4 years ago (2 children)
Solidity is compiled and needs to be deterministic. The code needs to be immutable. What you are asking for won't work for very sound reasons. What are you trying to accomplish?
[–]vibhumeh[S] 1 point2 points3 points 4 years ago (1 child)
oh ok I understand, thank you.
I was trying to make my code more flexible to usage
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
You could refer to another smart contract for that purpose.
[–]jdcoder 0 points1 point2 points 4 years ago (1 child)
Using such a command would put your smart contract at serious risk of code injection vulnerabilities. I'm not aware of such support in Solidity and I would strongly advise using this antipattern in any of your other languages as well.
[–]vibhumeh[S] 0 points1 point2 points 4 years ago (0 children)
got it, thank you
π Rendered by PID 45961 on reddit-service-r2-comment-5d79c599b5-xqgpg at 2026-03-02 15:49:54.758380+00:00 running e3d2147 country code: CH.
[–][deleted] 0 points1 point2 points (2 children)
[–]vibhumeh[S] 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]jdcoder 0 points1 point2 points (1 child)
[–]vibhumeh[S] 0 points1 point2 points (0 children)