src/control-flow-basics/functions.md
# // Copyright 2023 Google LLC
# // SPDX-License-Identifier: Apache-2.0
#
fn gcd(a: u32, b: u32) -> u32 {
if b > 0 { gcd(b, a % b) } else { a }
}
fn main() {
dbg!(gcd(143, 52));
}
; at the end of the expression. The return keyword
can be used for early return, but the "bare value" form is idiomatic at the
end of a function (refactor gcd to use a return).(). The
compiler will infer this if the return type is omitted.