This week's code snippet, Baklava in V, is brought to you by Subete and the Sample Programs repo.
module main
fn str_repeat(n int, s string) string {
mut result := ""
for _ in 0 .. n {
result += s
}
return result
}
fn main() {
for i in -10 .. 11 {
num_spaces := if i >= 0 { i } else { -i }
println(str_repeat(num_spaces, " ") + str_repeat(21 - 2 *num_spaces, "*"))
}
}
Below you'll find an up-to-date list of articles by me on The Renegade Coder. For ease of browsing, emojis let you know the article category (i.e., blog: βοΈ, code: π», meta: π, teach: π)
- π So You Want to Be a University Educator
- βοΈ Looking Forward to the Future
- π» Unpacking the Jargon Around Compilers, Interpreters, and More
- π» What Are Type Hints in Python?
- π» The Problem Enums Are Intended to Solve
- π» What Is Unit Testing in Python?
- π» What Is a Function in Python?
- π» What Is Operator Overloading in Python?
- π» What Is the Assignment Operator in Python?
- π As a Student, You Are a Lab Rat
Also, here are some fun links you can use to support my work.
This document was automatically rendered on 2024-11-15 using SnakeMD.