Const Call Maker

Run Settings
LanguageNim
Language Version
Run Command
import macros, strutils macro genStrConst*(name, str: static[string]): stmt = newConstStmt(newIdentNode(name), newStrLitNode(str)) genStrConst("Nim", "Great") echo Nim template callMacro(s: expr) = genStrConst(s, s) callMacro("Stefan") echo Stefan template callMacro2(s: expr) = const t = toLower(s[0]) & substr(s, 1) genStrConst(s, t) callMacro2("Salewski") echo Salewski template callMacro3(s1: expr) = const s = astToStr(s1) const t = toLower(s[0]) & substr(s, 1) genStrConst((s), (t)) callMacro3(NoQuotes) echo NoQuotes
Editor Settings
Theme
Key bindings
Full width
Lines