]> git.cworth.org Git - rust-learning/commit
Return an actual value from main
authorCarl Worth <cworth@cworth.org>
Tue, 10 Mar 2026 01:52:58 +0000 (18:52 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 12 Mar 2026 04:14:17 +0000 (21:14 -0700)
commit45b4fb4058591995c405572f8921086b79325077
treeaa1ffbce96bf3b2b6d5eff260fcc64c47315ad5c
parentdda4d791f07485f7e71e3f2197abdba3cce5493c
Return an actual value from main

This is a more idiomatic behavior from main, using a Result to return
either the unit type (which will cause a return of 0) or else an Error
(coerced from a string by using .into()). In that case, the program
will print "Error: " and our error string before exiting with a value
of 1.
src/main.rs