hyper 发表于 2017-6-15 11:51:34

println不支持字符串参数?

问题1.
E- *Error* defun: argument #1 should be a symbol (type template = "sgg") - (printcmpName)
E- *Error* load: error while loading file - "study.il" at line 18
defun(printcmpName() 函数名后没有加空格

修改:defun(printcmpName ()

问题2.
Command > funcTest
"***************************"
E- *Error* println: argument #2 should be an I/O port (type template = "gp") - "everyone"
println("hello, %s!" name) 调用有问题,不支持字符串参数

修改:printf("hello, %s!\n" name)

hyper 发表于 2017-6-15 11:56:59

修改了下罗老师的程序,函数数的调用,不用声明么,放后面也可以
axlCmdRegister("funcTest" 'funcTest)

defun(funcTest ()
                printMessage("everyone")
                printMessage("lili")
                printMessage("kity")
                printcmpName()
);end defun



defun(printMessage (name)
                println("***************************")
                printf("hello, %s!\n" name)
                println("***************************")
);end defun

defun(printcmpName ()
                name = nthelem(2 getSystemName());
                printMessage(name)
);end defun

ammint 发表于 2017-6-20 09:04:06

println不需要声明类型,自动匹配。

yfchen1003 发表于 2019-5-15 11:00:40

谢谢分享!!
页: [1]
查看完整版本: println不支持字符串参数?