Answer

问题及解答

[Sowya] print 和 println

Posted by haifeng on 2023-06-22 10:19:15 last update 2023-06-22 10:21:35 | Edit | Answers (0)

print 打印后面的字符串、数值、变量的值等等. 项和项之间用逗号隔开, 最后加分号.

例子:  

print "Hello World!";

print a, b, c, "\n", a+b, b*c;

 

>> :mode clox
> print "Hello World!";
Hello World!> var a=2, b=3, c=a*b;
> print a,b,c,"\n", a+b, b*c;
236
 518>

 

 

println 的功能基本等同于 print, 不过会在最后加上换行.

println "Hello World!";
Hello World!
>

println a,b,c,"\n", a+b, b*c;
236
 518
>