Array length: Difference between revisions
Content deleted Content added
add Zig example |
|||
Line 2,987:
<lang zkl>List("apple", "orange").len().println() //-->2, == L("apple", "orange")
T("apple", "orange").len().println() //-->2, read only list (ROList) </lang>
=={{header|Zig}}==
<lang zig>const std = @import("std");
pub fn main() !void {
// left hand side type can be ommitted
const fruit: [2][]const u8 = [_][]const u8{ "apples", "oranges" };
const stdout_wr = std.io.getStdOut().writer();
// slices and arrays have an len field
try stdout_wr.print("fruit.len = {d}\n", .{fruit.len});
}</lang>
=={{header|Zoea}}==
|