!!tag ortest {set("lang", if(or(eq(args.0, "py"), eq(args.0, "python")), "py", "js"))} {set("cstart", if(eq(get("lang"), "py"), "", "("))} {set("cend", if(eq(get("lang"), "py"), ":", ")"))} {set("or", if(eq(get("lang"), "py"), "or", "||"))} {set("name", if(eq(get("lang"), "py"), "Python", "your language"))} **Got code that looks like this, and it's not working properly?** ```{get("lang")} if {get("cstart")}x == "foo" {get("or")} "bar" {get("or")} "baz"{get("cend")} ``` That's because {get("name")} is interpreting your code as if it was: ```{get("lang")} if {get("cstart")}(x == "foo") {get("or")} "bar" {get("or")} "baz"{get("cend")} ``` If the first expression (`x == "foo"`) is false, the others are checked. **Expressions like `"bar"` will be treated as unrelated to `x`, and may be treated as true or false depending on the language *and have nothing to do with x's value!*** Try this instead: ```{get("lang")} if {get("cstart")}x == "foo" {get("or")} x == "bar" {get("or")} x == "baz"{get("cend")} ``` Or use a collection like an array/list/set and with those values and check if x is in the collection.
Format Markdown