| author | |
| committer | |
| log | ea3bd585634fa648cce7b597e611e9db35f5f929 |
| tree | 4c8a4796838c6320730820b99de8685d8deb8adc |
| parent | 96e7deadd44cbf95b72a729acaf5dd86523aa6b4 |
3 files changed, 18 insertions(+), 24 deletions(-)
example/README.md created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | # Zig Examples | ||
| 2 | |||
| 3 | ## Working Examples | ||
| 4 | |||
| 5 | * **Tetris** - A simple Tetris clone written in Zig. See | ||
| 6 | [andrewrk/tetris](https://github.com/andrewrk/tetris). | ||
| 7 | * **hello_world** - demonstration of a printing a single line to stdout. | ||
| 8 | One version depends on libc; one does not. | ||
| 9 | * **guess_number** - simple console game where you guess the number the | ||
| 10 | computer is thinking of and it says higher or lower. No dependency on | ||
| 11 | libc. | ||
| 12 | |||
| 13 | ## Work-In-Progress Examples | ||
| 14 | |||
| 15 | * **cat** - implementation of the `cat` UNIX utility in Zig, with no dependency | ||
| 16 | on libc. | ||
| 17 | * **shared_library** - demonstration of building a shared library and generating | ||
| 18 | a header file and documentation for interop with C code. | ||
example/multiple_files/foo.zig deleted-11| ... | @@ -1,11 +0,0 @@ | ||
| 1 | import "std.zig"; | ||
| 2 | |||
| 3 | // purposefully conflicting function with main.zig | ||
| 4 | // but it's private so it should be OK | ||
| 5 | fn private_function() { | ||
| 6 | %%stdout.printf("OK 1\n"); | ||
| 7 | } | ||
| 8 | |||
| 9 | pub fn print_text() { | ||
| 10 | private_function(); | ||
| 11 | } | ||
example/multiple_files/main.zig deleted-13| ... | @@ -1,13 +0,0 @@ | ||
| 1 | export executable "test-multiple-files"; | ||
| 2 | |||
| 3 | import "std.zig"; | ||
| 4 | import "foo.zig"; | ||
| 5 | |||
| 6 | pub fn main(args: [][]u8) -> %void { | ||
| 7 | private_function(); | ||
| 8 | %%stdout.printf("OK 2\n"); | ||
| 9 | } | ||
| 10 | |||
| 11 | fn private_function() { | ||
| 12 | print_text(); | ||
| 13 | } | ||