Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 81030 / 1,2-rust2html / example.rs
diff options
context:
space:
mode:
Commit5729bc0ea96fc0b944c243230910c537d692bcad (patch)
Author
 Radoslav Georgiev <rgeorgiev583@gmail.com>
2018-11-17 19:11:03 +0200
Committer
 dtrendafilov <trendafilov.dn@gmail.com>
2018-11-17 19:11:02 +0200
Files43db75a7acf93c6c2c8e07c3a87590fe14fb4e4f /homework/81030/1,2-rust2html/example.rs
IPL-5729bc0ea96fc0b944c243230910c537d692bcad.tar
IPL-5729bc0ea96fc0b944c243230910c537d692bcad.tar.gz
IPL-5729bc0ea96fc0b944c243230910c537d692bcad.zip
Parent9420791a9335fc174627bea5f2a25f434bbe7ae5 (diff)
implement the second homework assignment (#39)
* Rust syntax highlighter: fix some issues with the implementation of the first homework assignment * Rust syntax highlighter: pretty-printer: implement the second homework assignment
1 files changed, 29 insertions, 0 deletions
-rw-r--r--homework/81030/1,2-rust2html/example.rs29
diff --git a/homework/81030/1,2-rust2html/example.rs b/homework/81030/1,2-rust2html/example.rs
new file mode 100644
index 0000000..396aa0c
--- /dev/null
+++ b/homework/81030/1,2-rust2html/example.rs
@@ -0,0 +1,29 @@
+/*
+ * The following function returns the first answer.
+ * It takes no arguments and returns an unsigned integer.
+ */
+fn answer1() -> usize {
+ return 42; // answer to the Ultimate Question of Life, the Universe, and Everything
+}
+
+/*
+ * The following function returns the second answer.
+ * It takes no arguments and returns a floating-point number.
+ */
+fn answer2() -> f64 {
+ return -4.2;
+}
+
+/*
+ * The following function returns the third answer.
+ * It takes no arguments and returns a single character.
+ */
+fn answer3() -> char {
+ return 'E';
+}
+
+fn main() {
+ println!("The \"First Answer\" is: '{}'", answer1());
+ println!("The \"Second Answer\" is: '{}'", answer2());
+ println!("The \"Third Answer\" is: '{}'", answer3());
+}