aboutsummaryrefslogtreecommitdiff
path: root/rush00/ex01/rush01.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rush00/ex01/rush01.rs')
-rw-r--r--rush00/ex01/rush01.rs52
1 files changed, 52 insertions, 0 deletions
diff --git a/rush00/ex01/rush01.rs b/rush00/ex01/rush01.rs
new file mode 100644
index 0000000..70e1534
--- /dev/null
+++ b/rush00/ex01/rush01.rs
@@ -0,0 +1,52 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* rush01.rs :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/05/21 13:38:25 by charles #+# #+# */
+/* Updated: 2020/05/21 13:38:25 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+pub fn rush(x: i32, y: i32) {
+ if x == 0 || y == 0 {
+ return ;
+ }
+
+ if x >= 1 {
+ print!("/");
+ }
+ for _ in 1..x - 1 {
+ print!("*");
+ }
+ if x >= 2 {
+ print!("\\");
+ }
+ print!("\n");
+
+ for _ in 1..y - 1 {
+ print!("*");
+ for _ in 1..x - 1 {
+ print!(" ");
+ }
+ if x >= 2 {
+ print!("*");
+ }
+ print!("\n");
+ }
+
+ if y > 1 {
+ if x >= 1 {
+ print!("\\");
+ }
+ for _ in 1..x - 1 {
+ print!("*");
+ }
+ if x >= 2 {
+ print!("/");
+ }
+ print!("\n");
+ }
+}