def printIsoscelesTriangle(n: Int): Unit = {
for (i <- 1 to n) {
print("#" * i)
println()
}
}
// 调用函数并传入参数n
printIsoscelesTriangle(4)
调出来
#
##
###
####
def printIsoscelesTriangle(n: Int): Unit = {
for (i <- 1 to n) {
print("#" * i)
println()
}
}
// 调用函数并传入参数n
printIsoscelesTriangle(4)
调出来
#
##
###
####