F-Flat

F♭ (pronounced F-flat) is a toy language.


Project maintained by Hypercubed Hosted on GitHub Pages — Theme by mattgraham

The Fridge Game

fridge-game:
  [
    cls
    [
      'You are in a fridge. What do you want to do?'
      '1. Try to get out.'
      '2. Eat.'
      '3. Die.'
    ]
    [println] each
    {
      1 ['You try to get out. You fail. You die.']
      2 [
        'You eat. You eat some more.'
        'Damn, this food is tasty!'
        'You eat so much you die.'
      ]
      3 ['You die.']
    }
    prompt
    @
    dup null?
    [ drop [ 'Did not understand.' ] ]
    when
    '' <<
    'Play again? write y if you do.' <<
    [println] each
    prompt
    'y' =
      [ fridge-game ]
      [ 'Thanks for playing.' println clr ]
    branch
  ] ;

fridge-game

Translated from the source at Happy Learn Haskell Tutorial Vol 1