Advertisement
Guest User

Untitled

a guest
Apr 21st, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. pub fn testFn(str: []const u8) u8 {
  2. return str[0] - 'a';
  3. }
  4.  
  5. pub fn main() !void {
  6. var str: [4]u8 = undefined;
  7. str[1] = testFn("abcd") + if (testFn("abcd") > 5) 'a' - 10 else '0';
  8. }
  9.  
  10. ./test.zig:7:59: error: cannot store runtime value in type 'comptime_int'
  11. str[1] = testFn("abcd") + if (testFn("abcd") > 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| {
  15. ^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement