|
| 1 | +--- |
| 2 | +authors: |
| 3 | +- rzuckerm |
| 4 | +date: 2024-12-27 |
| 5 | +featured-image: baklava-in-every-language.jpg |
| 6 | +last-modified: 2024-12-27 |
| 7 | +layout: default |
| 8 | +tags: |
| 9 | +- baklava |
| 10 | +- lolcode |
| 11 | +title: Baklava in Lolcode |
| 12 | +--- |
| 13 | + |
| 14 | +<!-- |
| 15 | +AUTO-GENERATED -- PLEASE DO NOT EDIT! |
| 16 | +
|
| 17 | +Instead, please edit the following: |
| 18 | +
|
| 19 | +- sources/programs/baklava/lolcode/how-to-implement-the-solution.md |
| 20 | +- sources/programs/baklava/lolcode/how-to-run-the-solution.md |
| 21 | +
|
| 22 | +See .github/CONTRIBUTING.md for further details. |
| 23 | +--> |
| 24 | + |
| 25 | +Welcome to the [Baklava](https://sampleprograms.io/projects/baklava) in [Lolcode](https://sampleprograms.io/languages/lolcode) page! Here, you'll find the source code for this program as well as a description of how the program works. |
| 26 | + |
| 27 | +## Current Solution |
| 28 | + |
| 29 | +{% raw %} |
| 30 | + |
| 31 | +```lolcode |
| 32 | +HAI 1.2 |
| 33 | +
|
| 34 | +BTW Function to output a string n times |
| 35 | +HOW IZ I OUTPUT_N_TIMES_FOR YR string AN YR n |
| 36 | + IM IN YR loop UPPIN YR i TIL BOTH SAEM i AN BIGGR OF i AN n |
| 37 | + VISIBLE ":{string}"! |
| 38 | + IM OUTTA YR loop |
| 39 | +IF U SAY SO |
| 40 | +
|
| 41 | +BTW For n = 0 to 20 |
| 42 | +IM IN YR loop UPPIN YR n TIL BOTH SAEM n AN BIGGR OF n AN 21 |
| 43 | + BTW num_spaces = abs(n - 10) |
| 44 | + I HAS A num_spaces ITZ DIFF OF n AN 10 |
| 45 | + DIFFRINT num_spaces AN BIGGR OF 0 AN num_spaces |
| 46 | + O RLY? |
| 47 | + YA RLY |
| 48 | + num_spaces R PRODUKT OF -1 AN num_spaces |
| 49 | + OIC |
| 50 | +
|
| 51 | + BTW num_stars = 21 - 2 * num_spaces |
| 52 | + I HAS A num_stars ITZ DIFF OF 21 AN PRODUKT OF 2 AN num_spaces |
| 53 | +
|
| 54 | + BTW Output " " num_spaces times |
| 55 | + I IZ OUTPUT_N_TIMES_FOR YR " " AN YR num_spaces MKAY |
| 56 | +
|
| 57 | + BTW Output "*" num_stars times |
| 58 | + I IZ OUTPUT_N_TIMES_FOR YR "*" AN YR num_stars MKAY |
| 59 | +
|
| 60 | + BTW Output newline |
| 61 | + VISIBLE "" |
| 62 | +IM OUTTA YR loop |
| 63 | +
|
| 64 | +KTHXBYE |
| 65 | +
|
| 66 | +``` |
| 67 | + |
| 68 | +{% endraw %} |
| 69 | + |
| 70 | +Baklava in [Lolcode](https://sampleprograms.io/languages/lolcode) was written by: |
| 71 | + |
| 72 | +- rzuckerm |
| 73 | + |
| 74 | +If you see anything you'd like to change or update, [please consider contributing](https://github.com/TheRenegadeCoder/sample-programs). |
| 75 | + |
| 76 | +## How to Implement the Solution |
| 77 | + |
| 78 | +No 'How to Implement the Solution' section available. [Please consider contributing](https://github.com/TheRenegadeCoder/sample-programs-website). |
| 79 | + |
| 80 | +## How to Run the Solution |
| 81 | + |
| 82 | +No 'How to Run the Solution' section available. [Please consider contributing](https://github.com/TheRenegadeCoder/sample-programs-website). |
0 commit comments