summaryrefslogtreecommitdiff
path: root/exercises/quiz2.rs
diff options
context:
space:
mode:
authorSanjay K <sanjaykdragon@users.noreply.github.com>2020-05-19 12:47:44 -0400
committerGitHub <noreply@github.com>2020-05-19 18:47:44 +0200
commit010a04569282149cea7f7a76fc4d7f4c9f0f08dd (patch)
treec1c563b177e1207be2225a70c67c5d0a4d0ccf15 /exercises/quiz2.rs
parent51666609f1087231701c1dffe79420414f0beeb3 (diff)
feat: renames test to quiz, fixes #244
BREAKING CHANGE * changed test to quiz: fixes issues in #244 * fixed info.toml: #244 * fixed naming related issues
Diffstat (limited to 'exercises/quiz2.rs')
-rw-r--r--exercises/quiz2.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/exercises/quiz2.rs b/exercises/quiz2.rs
new file mode 100644
index 0000000..8caeaa9
--- /dev/null
+++ b/exercises/quiz2.rs
@@ -0,0 +1,30 @@
+// quiz2.rs
+// This is a quiz for the following sections:
+// - Strings
+
+// Ok, here are a bunch of values-- some are `String`s, some are `&str`s. Your
+// task is to call one of these two functions on each value depending on what
+// you think each value is. That is, add either `string_slice` or `string`
+// before the parentheses on each line. If you're right, it will compile!
+
+// I AM NOT DONE
+
+fn string_slice(arg: &str) {
+ println!("{}", arg);
+}
+fn string(arg: String) {
+ println!("{}", arg);
+}
+
+fn main() {
+ ("blue");
+ ("red".to_string());
+ (String::from("hi"));
+ ("rust is fun!".to_owned());
+ ("nice weather".into());
+ (format!("Interpolation {}", "Station"));
+ (&String::from("abc")[0..1]);
+ (" hello there ".trim());
+ ("Happy Monday!".to_string().replace("Mon", "Tues"));
+ ("mY sHiFt KeY iS sTiCkY".to_lowercase());
+}