all: change optional to result of io (#16075)

This commit is contained in:
yuyi 2022-10-16 14:28:57 +08:00 committed by GitHub
parent 6e46933c55
commit f6844e9766
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
187 changed files with 1885 additions and 1874 deletions

View file

@ -5,7 +5,7 @@ import os
const numeric_char = [`0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `.`, `e`, `E`]
// Convert expression to Reverse Polish Notation.
fn expr_to_rev_pol(expr string) ?[]string {
fn expr_to_rev_pol(expr string) ![]string {
if expr == '' {
return error('err: empty expression')
}
@ -63,7 +63,7 @@ fn expr_to_rev_pol(expr string) ?[]string {
}
// Evaluate the result of Reverse Polish Notation.
fn eval_rev_pol(rev_pol []string) ?f64 {
fn eval_rev_pol(rev_pol []string) !f64 {
mut stack := []f64{}
for item in rev_pol {
if is_num_string(item) {