Rust Language – Hello World

What is RUST?

Rust is an experimental, concurrent, multi-paradigm, compiled programming language developed by Mozilla Labs. It is designed to be practical, supporting pure-functional, concurrent-actor, imperative-procedural, and object-oriented styles. /wikipedia/

How to install it on your Gnu/Linux box?
Pre-requirements:

  • g++ 4.4 or clang++ 3.x
  • python 2.6 or later
  • perl 5.0 or later
  • gnu make 3.81 or later
  • curl


Download latest version (0.2 pre at the moment)

git clone https://github.com/mozilla/rust.git

Make it

$cd rust
$./configure
$ make & make install

Note:

It takes a lot of time and you do need an active internet connection during the compiling process.

Hack
Open your Geany or your favourite IDE and write this:

use std;

fn hello_world(name: str) {  
	let greetings: str = "Hello World, "+ name +"! and Здравей свят! and 您好,世界!";
	std::io::println(greetings);
}


fn main(args: [str]) {
	hello_world(args[1]);
}

Save it as helloworld.rs

Compile it

$rustc helloworld.rs

Execute

$./helloworld.rs Bogo //put here your name