Skip to content

Commit fecefde

Browse files
Add hello world to samples page (#397)
* Add hello world to samples page * renamed code files * update example
1 parent fdfab11 commit fecefde

File tree

8 files changed

+20
-6
lines changed

8 files changed

+20
-6
lines changed
File renamed without changes.
File renamed without changes.
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const std = @import("std");
2+
const stdout = std.io.getStdOut().writer();
3+
4+
pub fn main() !void {
5+
try stdout.print("hello world!\n", .{});
6+
}
7+
8+
// exe=succeed
9+
File renamed without changes.

content/en-US/learn/samples.smd

+11-6
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,40 @@
99
},
1010
---
1111

12+
# [Hello world]($heading.id('ext'))
13+
A minimal example printing hello world.
14+
15+
[]($code.language('=html').buildAsset("samples/hello-world.zig"))
16+
1217
# [Calling external library functions]($heading.id('ext'))
1318
All system API functions can be invoked this way, you do not need library bindings to interface them.
1419

15-
[]($code.language('=html').buildAsset("samples/0-windows-msgbox.zig"))
20+
[]($code.language('=html').buildAsset("samples/windows-msgbox.zig"))
1621

1722
# [Memory leak detection]($heading.id('leak'))
1823
Using `std.heap.GeneralPurposeAllocator` you can track double frees and memory leaks.
1924

20-
[]($code.language('=html').buildAsset("samples/1-memory-leak.zig"))
25+
[]($code.language('=html').buildAsset("samples/memory-leak.zig"))
2126

2227

2328
# [C interoperability]($heading.id('c-interop'))
2429
Example of importing a C header file and linking to both libc and raylib.
2530

26-
[]($code.language('=html').buildAsset("samples/2-c-interop.zig"))
31+
[]($code.language('=html').buildAsset("samples/c-interop.zig"))
2732

2833

2934
# [Zigg Zagg]($heading.id('zigg-zagg'))
3035
Zig is *optimized* for coding interviews (not really).
3136

32-
[]($code.language('=html').buildAsset("samples/3-ziggzagg.zig"))
37+
[]($code.language('=html').buildAsset("samples/ziggzagg.zig"))
3338

3439

3540
# [Generic Types]($heading.id('generic'))
3641
In Zig types are comptime values and we use functions that return a type to implement generic algorithms and data structures. In this example we implement a simple generic queue and test its behaviour.
3742

38-
[]($code.language('=html').buildAsset("samples/4-generic-type.zig"))
43+
[]($code.language('=html').buildAsset("samples/generic-type.zig"))
3944

4045

4146
# [Using cURL from Zig]($heading.id('curl'))
4247

43-
[]($code.language('=html').buildAsset("samples/5-curl.zig"))
48+
[]($code.language('=html').buildAsset("samples/curl.zig"))

0 commit comments

Comments
 (0)