Continue writing report
This commit is contained in:
parent
f36c9fef60
commit
834ed4b3e8
11 changed files with 128 additions and 23 deletions
|
@ -4,8 +4,6 @@ version = "0.1.0"
|
|||
authors = ["Marko Korhonen <marko.korhonen@reekynet.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
actix-web = "2.0.0"
|
||||
actix-rt = "1.0.0"
|
||||
|
|
25
tex/code/macro.rs
Normal file
25
tex/code/macro.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
macro_rules! laske {
|
||||
(lisää $num1:literal ja $num2:literal) => {
|
||||
println!("{} plus {} on {}", $num1, $num2, $num1 + $num2);
|
||||
};
|
||||
(vähennä $num1:literal ja $num2:literal) => {
|
||||
println!("{} miinus {} on {}", $num1, $num2, $num1 - $num2);
|
||||
};
|
||||
(kerro $num1:literal ja $num2:literal) => {
|
||||
println!("{} kertaa {} on {}", $num1, $num2, $num1 * $num2);
|
||||
};
|
||||
(jaa $num1:literal ja $num2:literal) => {
|
||||
println!("{} jaettuna {} on {}", $num1, $num2, $num1 / $num2);
|
||||
};
|
||||
}
|
||||
|
||||
laske!(lisää 10 ja 269);
|
||||
laske!(vähennä 652 ja 3);
|
||||
laske!(kerro 256 ja 2);
|
||||
laske!(jaa 100 ja 50);
|
||||
|
||||
// Tuloste:
|
||||
// 10 plus 269 on 279
|
||||
// 652 miinus 3 on 649
|
||||
// 256 kertaa 2 on 512
|
||||
// 100 jaettuna 50 on 2
|
4
tex/code/println.rs
Normal file
4
tex/code/println.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
macro_rules! println {
|
||||
() => { ... };
|
||||
($($arg:tt)*) => { ... };
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue