1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

paiza.ioでrust その9

Posted at

概要

paiza.ioでrustやってみた。
replを見つけたので、やってみた。

参考にしたページ

サンプルコード


use std::io::{self, Write};

fn main() {
    let mut input = String::new();
    loop 
    {
        print!("rust> ");
        io::stdout().flush().unwrap();
        input.clear();
        io::stdin().read_line(&mut input).unwrap();
        let prompt = input.trim();
        match prompt 
        {
        "exit" => {
            println!("Bye!");
            break;
        },
        _ => println!("{}", prompt),
        }
    }
}




実行結果

rust> 1 + 1
rust> foobar
rust> baz
rust> Bye!

成果物

以上

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?