Is echo $(....) valid as first argument for an echo statement?
eg (v0.11.2 on Win7)
echo 2.4321 - 2.1234 # <- this is OK 0.3087 echo (2.4321 - 2.1234) # <- this is OK 0.3087 echo "Txt join: " & $(2.4321 - 2.1234) # <- this is OK Txt join: 0.3087 echo "Txt join: ", $(2.4321 - 2.1234) # <- this is OK Txt join: 0.3087 echo $(2.4321 - 2.1234) # this errors echo $(2.4321 - 2.1234), " Txt join" # this errors echo $(2.4321 - 2.1234) & " Txt join" # this errors
Error: type mismatch: got (proc (x: varargs[expr]){.gcsafe, locks: 0.}, float) but expected one of: system.$(x: T) system.$(x: char) system.$(x: set[T]) system.$(x: string) system.$(w: WideCString, estimate: int) system.$(x: TEnum) system.$(x: int) system.$(x: float) system.$(x: seq[T]) system.$(x: int64) system.$(s: WideCString) system.$(x: bool) system.$(x: cstring)
When you write echo $2 this actually means \`$`(echo, 2). What you want is echo($2).
echo already applies $ on all its arguments as the proc definition implies:
proc echo*(x: varargs[expr, `$`])
Thanks,
so the following work, and it is best to avoid using the '$' for the sake of simplicity
echo ($(2.4321-2.1234) & " Txt join") echo 2.4321-2.1234, " Txt join"