Skip to content

Commit

Permalink
mod(zig): README.md followed pull request advices
Browse files Browse the repository at this point in the history
  • Loading branch information
eliestroun14 committed Aug 12, 2024
1 parent a5a1d81 commit d142e80
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions software/32.Zig/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
# Workshop 32 - Introduction to Zig

Welcome to this introductory workshop on Zig! Zig is a modern programming language that emphasizes robustness, performance and clarity. Today, you'll learn :
✔️ how to install Zig
✔️ create your first project
✔️ discover the language's key concepts by creating a few projects
✔️ How to install Zig
✔️ Create your first project
✔️ Discover the language's key concepts by creating a few projects

## Introduction

Zig is a general-purpose programming language focused on robustness, performance, and simplicity. It offers manual memory management, safety features, built-in cross-compilation, and seamless C interoperability, making it ideal for system programming and high-performance applications.

### Prerequisites

- Basic programming skills (C, C++, or any other language)
- A computer with Internet access

## Step 0 - SETUP

All the required information to install dependencies can be found in [SETUP.md](./SETUP.md).
Expand All @@ -30,12 +25,14 @@ For the first exercise, we simply ask you to write `Hello world!` in your termin

📌 Tasks:

create a file `main.zig` in a folder called `src` with your logic to print the "hello world"
Create a file `main.zig` in a folder called `src` with your logic to print the "hello world"

src
└── main.zig

📚 Documentation:

> 💡 Zig file has `zig` extension.
> 💡 Now, that you have created a file `main.zig`, you can use other files. To use them in your `main.zig` you have to integrate the module ([read more](https://stackoverflow.com/questions/71186556/how-do-i-include-one-zig-file-from-another-zig-file))
> 💡 Now, that you have created a file `main.zig`, you can use other zig files. To use them in your `main.zig` you have to integrate the module ([read more](https://stackoverflow.com/questions/71186556/how-do-i-include-one-zig-file-from-another-zig-file))
- [Build System](https://ziglang.org/learn/build-system/)
- [Doc.Zig](https://ziglang.org/documentation/master/)
Expand All @@ -50,8 +47,6 @@ create a file `main.zig` in a folder called `src` with your logic to print the "

## Step 2 - Palindrome?

> ❗ We strongly advise you to use the resources given for this exercise.
📑 Description:

For the second exercise, you have to create a function that takes as parameter a string `word`.
Expand All @@ -71,6 +66,21 @@ This function must return true if the word given in parameter is a palindrome an

✔️ Validation:

Here's a main example :

pub fn main() void {
const stdout = std.io.getStdOut().writer();

const test_word1 = "madam";
const test_word2 = "hello";

const result1 = is_palindrome(test_word1);
const result2 = is_palindrome(test_word2);

stdout.print("{} is palindrome: {}\n", .{test_word1, result1}) catch {};
stdout.print("{} is palindrome: {}\n", .{test_word2, result2}) catch {};
}

When you compile and run palindrome.zig, the output should be:

```sh
Expand All @@ -84,8 +94,6 @@ This function must return true if the word given in parameter is a palindrome an

## Step 3 - Fibonacci sequence

> ❗ We strongly advise you to use the resources given for this exercise.
📑 Description:

For the third exercise, you need to create a function that generates and displays the Fibonacci sequence up to a specified number of elements.
Expand Down Expand Up @@ -122,8 +130,6 @@ Here is a small example of the beginning of the Fibonacci sequence:

## Step 4 - A simple and useful `Calculator`

> ❗ We strongly advise you to use the resources given for this exercise.
📑 Description:

Let's go further now!
Expand Down

0 comments on commit d142e80

Please sign in to comment.