This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate regex; | |
use regex::Regex; | |
fn main() { | |
let sentence = "We're all dorks!"; | |
println!("{}", reverse_string(sentence).to_string()); | |
} | |
fn reverse_string(string: &str) -> String { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let bottles = function | |
| 0 -> "no more bottles" | |
| 1 -> "1 bottle" | |
| n -> Printf.sprintf "%d bottles" n;; | |
let rec sing n = | |
let current = bottles n in | |
let next = bottles (n-1) in | |
Printf.printf | |
"%s of beer on the wall, %s of beer.\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2019-06-08T13:38:16.825Z","extensionVersion":"v3.2.9"} |
OlderNewer