使用 puts 在 Tcl 中打印逗号分隔的坐标
Comma separated coordinates printing in Tcl using puts
如何使用puts打印一个三角形坐标(1,2) (3,4) (5,6)?我收到报价错误。
puts "triangle just added is" "( " $ax "," $ay ") " "( " $bx "," $by ") " "( " $cx "," $cy ") "
puts
接受一个参数(要写入标准输出的字符串)或两个(要写入的通道和字符串)。好吧,还有可选的 -nonewline
选项,所以实际上有 2 或 3 个参数。你给它的比这多得多,因此会出错。
像许多脚本语言一样,tcl 会在双引号字符串中扩展变量:
puts "triangle just added is ($ax,$ay) ($bx,$by) ($cx,$cy)"
如何使用puts打印一个三角形坐标(1,2) (3,4) (5,6)?我收到报价错误。
puts "triangle just added is" "( " $ax "," $ay ") " "( " $bx "," $by ") " "( " $cx "," $cy ") "
puts
接受一个参数(要写入标准输出的字符串)或两个(要写入的通道和字符串)。好吧,还有可选的 -nonewline
选项,所以实际上有 2 或 3 个参数。你给它的比这多得多,因此会出错。
像许多脚本语言一样,tcl 会在双引号字符串中扩展变量:
puts "triangle just added is ($ax,$ay) ($bx,$by) ($cx,$cy)"