Skip to content

A small collection of basic exercises in rust from when I participles at the first rust workshop from NXPxUPB from nov 2022

Notifications You must be signed in to change notification settings

mariateodorapopescu/rust-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Workshop Learnings

Welcome to the rust-workshop repository, where I've compiled a collection of basic exercises and learnings from my participation in the first Rust workshop conducted by NXPxUPB in November 2022.

Overview

Rust is a powerful and expressive language, and through this workshop, I delved into various aspects of the language. Here are some key takeaways and snippets of wisdom:

Functions and Parameters

Rust allows us to define functions with parameters, special variables that form a function's signature. These parameters are replaced by concrete values called arguments when you invoke the function. Understanding this interplay is crucial for effective Rust programming.

Error Handling

The main error message, "mismatched types," highlights a common issue: returning a value from a function that expects a different type. Rust suggests removing semicolons, transforming statements into expressions, to resolve this mismatch.

Match Expressions

The match expression is a powerful construct in Rust. For instance, in a guessing game scenario, it efficiently handles the comparison of user guesses with a randomly generated secret number, providing clarity in code organization.

Structs

Structs in Rust serve as templates for creating instances with specific data. Whether defining a general template or a tuple struct, structs enhance code readability by labeling and organizing data.

If Expressions

The if expression facilitates conditional branching in Rust. The condition must evaluate to a boolean, and the associated block of code executes if the condition is true. Adding an optional else expression provides an alternative block for false conditions.

About

A small collection of basic exercises in rust from when I participles at the first rust workshop from NXPxUPB from nov 2022

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published