![]()
if...else if...else
You’ll often want you program to make decisions and change its behavior based on testing some condition. For example, only print a value if it is greater than 10. Like most languages, MEL has an if control structure:
You can also specify code to run when the condition is not true with the else keyword:
if ($x > 10) { print("It's greater than 10!\n"); print("Run!!!\n"); } else { print("It's not above 10.\n"); print("It's safe... for now.\n"); }You can specify several alternatives with the else if statement: