Baklava in Wyvern

Published on 03 October 2024 (Updated: 03 October 2024)

Welcome to the Baklava in Wyvern page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

require stdout

def strRepeat(n:Int, s:String): String
    if (n < 1) { "" } else { s + strRepeat(n - 1, s) }

def abs(n:Int): Int
    if (n < 0) { -n } else { n }

def baklava(n:Int, end:Int): Unit
    // This is definitely the weirdest formatting for an if-else statement that I've ever seen
    if (n > end)
            unit
        else
            val numSpaces:Int = abs(n)
            stdout.print(strRepeat(numSpaces, " ") + strRepeat(21 - 2 * numSpaces, "*") + "\n")
            baklava(n + 1, end)

baklava(-10, 10)

Baklava in Wyvern was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.