Skip to content

Instantly share code, notes, and snippets.

@TelegramSam
Created April 6, 2011 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TelegramSam/905948 to your computer and use it in GitHub Desktop.
Save TelegramSam/905948 to your computer and use it in GitHub Desktop.
else in krl
ruleset a8x152 {
meta {
name "if then else"
description <<
Demonstrates the power of actions to enable 'else' in krl!
>>
author "Sam Curren"
logging off
}
dispatch {
// Deploy via bookmarklet
}
global {
ifthenelse = defaction(cond, t, f){
a = cond => t | f;
a();
};
}
rule first_rule {
select when pageview ".*" setting ()
pre {
testcond = ent:counter % 2 == 1;
}
ifthenelse(
testcond,
defaction(){notify("test","counter odd!");},
defaction(){notify("test","counter even!");}
);
always {
ent:counter += 1 from 1;
}
}
}
@MikeGrace
Copy link

OH MY!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment