在条件匹配时打印两件东西

时间:2011-02-22 17:27:05

标签: sml

if (1=1)
then print "sdfsdfs" and print "sdfsdfsdfsdf"
else print "sdfsdf";

这会出错。如果条件匹配,我想做两件事。我怎么能这样做?

1 个答案:

答案 0 :(得分:2)

将命令括号并用分号分隔:

if 1=1
then (print "sdfsdfs"; print "sdfsdfsdfsdf")
else print "sdfsdf"