Created
April 6, 2011 16:13
-
-
Save TelegramSam/905948 to your computer and use it in GitHub Desktop.
else in krl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OH MY!!!!