Character classification. Now that we have and, or, >=, <=, and character literals, these are clean single-line conditions:
fn is_space(c: i64) i64 {
if (c == ' ' or c == '\n' or c == '\r' or c == '\t') { return 1; }
return 0;
}
fn is_letter(c: i64) i64 {
if (c >= 'a' and c <= 'z') { return 1; }
if (c >= 'A' and c <= 'Z') { return 1; }
if (c == '_') { return 1; }
return 0;
}
fn is_digit(c: i64) i64 {
if (c >= '0' and c <= '9') { return 1; }
return 0;
}
fn is_alnum(c: i64) i64 {
if (is_letter(c) == 1 or is_digit(c) == 1) { return 1; }
return 0;
}
Compare with the Zig interpreter's versions -- they're nearly identical. is_digit is c >= '0' and c <= '9' in both languages now.