A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Baklava in Solidity page! Here, you'll find the source code for this program as well as a description of how the program works.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract Baklava {
function main (string memory) public pure returns (string memory) {
string memory output = '';
for (int i = -10; i <= 10; i++) {
int numSpaces = (i >= 0) ? i : -i;
output = string.concat(output, strRepeat(numSpaces, ' '));
output = string.concat(output, strRepeat(21 - 2 * numSpaces, '*'));
output = string.concat(output, '\n');
}
return output;
}
function strRepeat(int n, string memory s) private pure returns (string memory) {
string memory r = '';
for (int i = 0; i < n; i++) {
r = string.concat(r, s);
}
return r;
}
}
Baklava in Solidity was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.