Logo

Programming Language

View the Project on GitHub meganmrichardson/Medley

Program Examples

Hello World

juice "Hello, World!" |

Array

berrybasket ~intberry~ arr is ~3; 4; 3~ |

Dictionary

fruitbasket ~stringberry, intberry~ dict is ~"a", 1; "b", 2; "c", 3~ |

While Loop


intberry i is 2 |
whilemelon i less 10 ->
  juice " " plus i |
  i++ |
<-
        

For Loop


formelon intberry i is 10 | i more equals num | i-- ->
  juice "the number is " plus i |
<-
        

If Statement


ifmelon 1 plus 1 equals 2  ->
  juice "this is factual information" | :: this is a comment
<-
        

If-Else Statement


ifmelon organic -> 
  juice 1 | 
<- elifmelon gmo -> 
  juice 0 |
<- elsemelon -> 
  juice 2 | 
<-
        

Simple Add Function


intberry blend add(intberry first, intberry second) ->
  squeeze first plus second |
<-
juice add(10, 15) |
        

Printing Operation Results


juice 3 to the power of 2 | :: = 9 
juice 20 mod 10 | :: = 0
juice 5 less equals 6 | :: = organic (true)
        

Fibonacci


intberry blend fibonacci(intberry num) ->
  intberry num1 is 0 |
  intberry num2 is 1 |
  intberry sum |
  intberry i is 0 |
  formelon i is 0 | i less num | i++ ->
    sum is num1 plus num2 |
    num1 is num2 |
    num2 is sum |
  <-
  squeeze num2 |
<-
juice fibonacci(10) | :: function call
        

First Factorial


intberry blend firstFactorial(intberry num) ->
  ifmelon num equals 0 orange num equals 1 ->
    squeeze 1 |
  <-
  squeeze num times firstFactorial(num minus 1) |
<-
        

Primes


:: outputs all prime numbers between 0 and 100
intberry lowestNumber is 0 |
intberry highestNumber is 100|
formelon intberry i is lowestNumber | i more equals highestNumber | i++ ->
  intberry flag is 0 |
  formelon intberry j is 2 | j less i | j++ ->
    ifmelon i mod j equals 0 ->
      flag is 1 |
      split |
    <-  
  <-
  ifmelon i more 1 apple flag equals 0 ->
    juice i |
  <-
<-