Go to file
Matthew Williamson e0274e07d0 Create iterators4.rs
Tackles https://github.com/carols10cents/rustlings/issues/15 . I think this allows for varying levels of difficulty depending on a users background. But ideally people can move there way up from 1, 2, 3 (Numbers below).

1. 
    let mut result = 1;
    for i in 1..x + 1 {
        result *= i;
    }
    result

2. 
    match x {
        0 | 1 => 1,
        x => x * factorial(x - 1),
    }
3. 
    (1..x + 1).product()
2017-01-05 22:38:07 -05:00
error_handling Add more hints, better test failures, etc to errorsn 2016-06-21 11:10:21 -04:00
functions Just remembered another function one I wanted to do 2015-09-18 20:28:27 -04:00
if Create tests for if1.rs 2016-06-14 17:07:36 +02:00
modules Add module exercises from jdm! 🎉 2015-09-17 22:21:56 -04:00
move_semantics Fix typo in hint for move_semantics1.rs. 2015-11-16 17:52:41 -07:00
primitive_types Add tuple indexing exercise from @ruipserra!! 👏 2016-02-07 12:34:53 -05:00
standard_library_types Create iterators4.rs 2017-01-05 22:38:07 -05:00
strings Incorporate changes from @pindell-matt! 🚀 2016-07-05 09:00:56 -04:00
tests Add directions on running tests 2016-05-12 19:59:44 -04:00
threads Moved away from deprecated thread::sleep_ms 2016-02-08 14:26:23 -07:00
variables Add hints to the variable bindings exercises 2015-09-17 19:16:30 -04:00
.gitignore Ignore temporary .swp files 2016-02-09 15:23:50 -05:00
ex1.rs Create ex1.rs 2015-09-14 22:26:11 -04:00
ex2.rs Create ex2.rs 2015-09-14 22:26:38 -04:00
ex3.rs Create ex3.rs 2015-09-14 22:26:58 -04:00
ex4.rs Create ex4.rs 2015-09-15 20:29:05 -04:00
ex5.rs Create ex5.rs 2015-09-16 09:49:09 -04:00
LICENSE Update LICENSE year. 2016-03-27 15:57:49 -04:00
README.md changed URLs to https scheme where possible 2016-08-15 07:02:36 +03:00

rustlings

Small exercises to get you used to reading and writing Rust code. Includes practice reading and responding to compiler messages!

This repo is very much the smallest thing that could possibly work :)

To do these exercises

Thanks to btbytes' prlinks, you can now click on the links below to load the exercises in the rust playground!

There are infinite correct answers-- the exercises are sometimes left very open-ended. Scroll down in the playground to find comments that have hints.

If you need more help or would like to compare solutions, you can ask in #rust-beginners on irc.mozilla.org, the user forum, or the subreddit. If an exercise could be improved in any way, please create an issue or submit a pull request!

Variable bindings

Relevant chapter in The Rust Programming Language

Functions

Relevant chapter in The Rust Programming Language

Primitive types

Relevant chapter in The Rust Programming Language

Tests

Going out of order from the Syntax and Semantics section of the book to cover tests-- many of the following exercises will ask you to make tests pass!

Testing chapter from the Effective Rust section of the book

If

Relevant chapter in The Rust Programming Language

Strings

Relevant chapter in The Rust Programming Language

Move semantics

These exercises are adapted from pnkfelix's Rust Tutorial -- thank you Felix!!!

Relevant chapters in the book:

Note that the exercises in this section may look similar to each other but they are subtly different :)

Modules

Relevant chapter in The Rust Programming Language

Error Handling

The Error Handling and Generics sections are relevant.

Standard library types

Arc

The Concurrency section is relevant.

Iterators

Do not adjust your monitors-- iterators 1 and 2 are indeed missing. Iterator 3 is a bit challenging so we're leaving space for some exercises to lead up to it!

Check out the Iterators chapter of the book and the Iterator docs.

Threads

See the Dining Philosophers example and the Concurrency Chapter from the book.

Uncategorized

A few exercises based on things I've encountered or had trouble with getting used to.

To help with this repo/TODO list

  • File issues for problems or suggestions!
  • Contribute more exercises! Anything that took you time to get used to, or that you had trouble with, or that deserves practice would be a good exercise!
  • How could the process of doing these exercises work better? This is an open-ended question :) Are the playground links good enough? Are there ways that we could make going to the next exercise easier without forking the playground??