0 10 DATA "GRANNY", "MONSTER", "GRANNY", "CAT", "END" 20 READ A$ 100 IF A$="GRANNY" THEN GOSUB 1010 200 IF A$="MONSTER" THEN GOSUB 2010 300 IF A$="CAT" THEN GOSUB 3020 400 IF A$="END" THEN GOTO 10000 500 GOTO 20 1010 LET JAR = JAR + 4 1015 PRINT "YOU LOOK SKINNY, GET SOME COOKIES" 1020 RETURN 2010 IF JAR = 0 THEN PRINT "NO COOOKIE, ME SAD" 2020 IF JAR > 0 THEN PRINT "OM NOM NOM" 2030 LET JAR = 0 2040 RETURN 3020 PRINT "MEOW" 3030 LET JAR = JAR - 1 3040 RETURN 10000 END READY.
remove_cookies(amount) if amount > @count @count = 0 else @count -= amount end end def add_cookies(amount) @count += amount end end Lucas Dohmen https://gist.github.com/moonglum/f763eb257a4ede22e3008d861225535c
jar then 0 else jar - n cat = modify (takeCookies 1) grandma = modify (+10) cookieMonster = put 0 workflow = do cat cookieMonster grandma cookieMonster run = execState workflow 5 Martin Kühl https://gist.github.com/joyclark/843932d96dbf99ab8438cb9de485d10f
cookie_jar.remove_cookies(3) ## The lid is off for kitten! amount > @count => false @count -= amount cookie_jar.count_cookies => 2 cookie_jar.remove_cookies(4) ## The lid is off for kitten! ## We’ll wait until it’s back on ## The lid is off for ghost! amount > @count => false @count = 0 cookie_jar.count_cookies => 0 @iamjoyclark
cookie-jar 2)) (swap! cookie-jar grandma 5) (swap! cookie-jar kitten) (swap! cookie-jar ghost) @cookie-jar // => 7: retrieves current value of cookie-jar Joy Clark https://github.com/joyclark/cookie-jar