When programmers say that a character is "illegal" or that overriding a method in a certain way is "legal," what exactly do they mean? Does it simply mean that the programming language allows or disallows it, and what happens if I use something that isn't allowed?
3 Answers
“Legal” just means permitted by the rules of the programming language. An “illegal character” is one that isn’t allowed in that particular location, while a legal method override follows the language’s rules. If you break those rules, the compiler or interpreter usually reports an error, and the program may not compile or run correctly.
Sometimes people use “legal” specifically to mean syntactically valid: the code is written in a form the language recognizes. Invalid syntax is commonly caught before the program runs, although some rule violations may only appear during execution depending on the language.
Think of it like chess or basketball. Moving a knight in a straight line is an illegal chess move because it violates the game’s rules. Similarly, code can be illegal when it breaks the syntax or rules defined by the language. Nothing criminal is involved—it’s just a technical way to say “not allowed.”

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically