Print newline in Fish (the programming language)?

I'm having trouble with the fish programming language wherein I cannot make a single (or, in fact, any length of) character (not including quotes) new line. Not even regex works for this. As it is a 2-D Programming Language, a new line breaks the code - it doesn't execute as intended. My code is a modified fibonacci sequence generator as shown on the wiki page, but uses literal spaces to print to the command line. It is below, if this helps in any way:

0:n" "o1:nv
 n:+@:o" "<

So, my question is this: is there a newline character or series of characters that I can use instead of the spaces? Should I pursue a different new line procedure (ie running as many outputs as I need to a file and THEN changing them all to new lines)?


Looked a little harder and cleared my eyes, and, after looking at an ASCII table and examining stacks in Fish, I realized my answer was as simple as this:

ao;

The reasoning behind this Fish stores characters in the stack as numbers. Therefore, loading the number 10 (Fish accepts hexadecimal in src) into the stack and then printing it with o (simple character output) prints a carriage return.

Therefore, my code becomes:

0:nao1:nv
 n:+@:oa<

That was so obvious it hurt after I did that. Hopefully this helps someone else in the future.

链接地址: http://www.djcxy.com/p/88124.html

上一篇: 使用PHP hash()和NodeJS crypto.createHash()比较SHA256,

下一篇: 在Fish中打印换行符(编程语言)?