Coding Challenge Day

We had so much fun at our Perl coding day that we decided to have another one! To keep things interesting, the language we're using will be announced at the event. Nick is going to come up with a list of coding challenges that we'll tackle with cooperation and friendly competition!

The coding day will be 3-5 PM, Saturday, 21 November, at Internationalist Books in Carrboro. Bring a laptop! (Snacks are also welcome)

The Day Of!

We chose Rust as the language for this challenge. It was a bit of a struggle even to put together a Fibonacci sequence generator - this language has a steep learning curve!

Here's a factorial calculator, demonstrating recursion:

use std::io;

fn fibber (x:i32) -> i32{
	if x == 0 {
	return 0;
	}
	else if x == 1 {
	return 1;
	}
	else {
	return fibber(x-2) + fibber(x-1); }
}

fn main (){
	let mut input = String::new();
	io::stdin().read_line(&mut input).ok().expect("Failed to read line");
	let num_in: i32 = input.trim().parse().ok().expect("Please type a number!");
	println!("Fibonacci sequence number {} is {}", num_in , fibber(num_in));
	}

John also filled in the slow moments with an overview of lockpicking!



Creative Commons License
This site is licensed under a Creative Commons Attribution 4.0 International License.