mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 13:11:32 +00:00
language: add unary plus & minus, post increment & decrement operators, non-newline print builtin. fix block comments
This commit is contained in:
20
examples/suffix.pork
Normal file
20
examples/suffix.pork
Normal file
@ -0,0 +1,20 @@
|
||||
/* Barber shop sign generator! */
|
||||
func generatePole(width, height) {
|
||||
var i = 0
|
||||
while i < height {
|
||||
let index = i++ mod width
|
||||
var j = 0
|
||||
while j < width {
|
||||
if j == index { print("#") } else { print("_") }
|
||||
j++
|
||||
}
|
||||
println()
|
||||
}
|
||||
}
|
||||
|
||||
export func main() {
|
||||
println("nobody:")
|
||||
println()
|
||||
println("barber pole:")
|
||||
generatePole(6, 18)
|
||||
}
|
Reference in New Issue
Block a user