Advertisement
Guest User

Untitled

a guest
Apr 21st, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. pub fn main() !void {
  2. var str: [4]u8 = undefined;
  3. var a = 5;
  4. str[1] = if (a > 5) 'a' - 10 else '0';
  5. }
  6.  
  7. ./test.zig:3:5: error: variable of type 'comptime_int' must be const or comptime
  8. var a = 5;
  9. ^
  10. ./test.zig:4:18: note: referenced here
  11. str[1] = if (a > 5) 'a' - 10 else '0';
  12. ^
  13. /usr/lib/zig/std/start.zig:334:40: note: referenced here
  14. const result = root.main() catch |err| {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement