2018年1月2日火曜日

はじめてのRustとD

ある砂場でcargo new projectnameとするとCargo.tomlの入ったディレクトリがでける
cd projectnamede  => write main.rs in ./src => cargo build => cargo run!!

---------------------------------------------

old manual is as
http://wisdom.sakura.ne.jp/programming/d/d10.html
import std.stream;

class Point { int x , y;  }
class Size { int width = 400, height = 300; }


int main() {
 Point point = new Point;
 Size size = new Size;

 stdout.printf("point = %d, %d\n" , point.x , point.y);
 stdout.printf("size = %d, %d\n" , size.width , size.height);
 return 0;
this code may not run
in this case
import std.stdio;

class Point { int x , y;  }
class Size { int width = 400, height = 300; }


int main() {
 Point point = new Point;
 Size size = new Size;

 writeln("point = " , point.x , ",", point.y);
 writeln("size = " , size.width ,"," size.height);
 return 0;
}
dmd target.d  see https://tour.dlang.org/ or wanaD  is convenient blog
but in standard, you should browse https://dlang.org/library/std/stdio/writeln.html

0 件のコメント:

コメントを投稿