sample-code: print->println to match interpreter behavior
This commit is contained in:
parent
695c812bf5
commit
a8b8a91c79
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
for num in 0..=30 {
|
for num in 0..=30 {
|
||||||
print("fib(", num, ") = ", fib_iterative(num))
|
println("fib(", num, ") = ", fib_iterative(num))
|
||||||
}
|
}
|
||||||
for num in 0..=30 {
|
for num in 0..=30 {
|
||||||
print("fib(", num, ") = ", fib(num))
|
println("fib(", num, ") = ", fib(num))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ fn main() {
|
|||||||
// Outputs FizzBuzz for numbers between `start` and `end`, inclusive
|
// Outputs FizzBuzz for numbers between `start` and `end`, inclusive
|
||||||
fn fizzbuzz(start: i128, end: i128) {
|
fn fizzbuzz(start: i128, end: i128) {
|
||||||
for x in start..=end {
|
for x in start..=end {
|
||||||
print(if x % 15 == 0 {
|
println(if x % 15 == 0 {
|
||||||
"FizzBuzz"
|
"FizzBuzz"
|
||||||
} else if 0 == x % 3 {
|
} else if 0 == x % 3 {
|
||||||
"Fizz"
|
"Fizz"
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
print("Hello, world!")
|
println("Hello, world!")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user