How to use f-string in mojo
I want to write a ppm file in mojo using f-string pattern. e.g., thingss like:
out.write(f"P3\n{pic.size_X} {pic.size_Y}\n255\n")
out.write(f"{clamp(round(r))} {clamp(round(g))} {clamp(round(b))} ")
etc. But I can't use f-strings in mojo. Plus if I try to do like this:
out.write("P3\n",picture.size_X, picture.size_Y,"\n255\n")
It gives me the following error:
error: no matching function in call to 'write':
out.write("P3\n",picture.size_X, picture.size_Y,"\n255\n")
~~~^~~~~~~~~~~
/home/talha/Desktop/mojo/jpeg/C-code/Mojo/main.mojo:1:1: note: candidate not viable: callee expects 2 arguments, but 5 were specified
Can someone please help me how to write files?
out.write(f"P3\n{pic.size_X} {pic.size_Y}\n255\n")
out.write(f"{clamp(round(r))} {clamp(round(g))} {clamp(round(b))} ")
etc. But I can't use f-strings in mojo. Plus if I try to do like this:
out.write("P3\n",picture.size_X, picture.size_Y,"\n255\n")
It gives me the following error:
error: no matching function in call to 'write':
out.write("P3\n",picture.size_X, picture.size_Y,"\n255\n")
/home/talha/Desktop/mojo/jpeg/C-code/Mojo/main.mojo:1:1: note: candidate not viable: callee expects 2 arguments, but 5 were specified
Can someone please help me how to write files?
