Jump to content

Array length: Difference between revisions

add Zig example
(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}}==
37

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.