`echo $?` returns the exit code of the previous command

$ false
$ echo $?
1
$ echo "hello"
$ echo $?
0