Operator %

Why this is compiled:

a_a = "aa" % 'a'
puts a_a

vladimir@Veriton:~$ crystal “/home/vladimir/Code/Crystal/MySamples/test1.cr”
aa
vladimir@Veriton:~$ crystal -v
Crystal 1.6.2 [879691b2e] (2022-11-03)
LLVM: 13.0.1
Default target: x86_64-unknown-linux-gnu

It’s basically a shortcut to sprintf. See String - Crystal 1.7.0-dev.

1 Like

Thanks a lot!