NOTE

From Esolang
Jump to navigation Jump to search

NOTE is an esolang created by User:ResU in 2021. It uses one-based indexing.

Arrays

Arrays are created like this: example = Hello, world! In this case, example/1\ is Hello, and example/2\ is world!. example/x\ also works for strings. example/x\/y\ is the yth letter of the xth word.

Error

When an error occurs, "Never Gonna Give You Up" plays. After the video stops rickrolling you, you can use the ".open/example.com\" command which sends you to example.com.

Commands

Command Description
.replace/example, 1, "x"\ Replaces the second item in example with "x". It can also append an item to the end of example.
.if Is an if statement.
.length/example\ Is the amount of items in example
.while Is a while loop.
.print/"x"\ Prints "x".
! Is a NOT gate.
|x All programs of this type where x is replaced by anything (except /n) are nops.
.debug/\ Debugs the code in the console. Argument optional. The argument gets printed.
.import/example.nt\ Imports all functions defined in the program example.nt.
.define/x,y,z\ } Defines a function with the name x, and arguments y and z.
.do/x=x+1\ Adds 1 to x. .do/x\ does x.
.str/x\ x is converted to a string.

Examples

Hello, world!

.print/"Hello, world!"\

Quine

.define/quine,x\
.print/x+.str/x\+"\"\
}
.quine/".define/quine,x\
.print/x+str/x\+"\"\
}
.quine/"\

Cat program

a="Put your input here."
.debug/a\

Reverse cat

a="Put your input here."
b=1
.while b<=(length/a\/2):
.replace/a,a/b\,a/length/a\-b\\
}
.debug/a\

Truth machine

a=0 |This variable can be either 0 or 1.
.if a=1:
b=1
.while b>0:
b=b+1
.print/1\
}
}
.if a=0:
.print/0\
}

99 bottles of beer

a=99
.while a>1:
.print/a" bottles of beer on the wall,"\
.print/a" bottles of beer."\
a=a-1
.print/"Take one down and pass it around, "a" bottles of beer on the wall."\
}
.print/a" bottle of beer on the wall,"\
.print/a" bottle of beer."\
.print/"Take one down and pass it around, no bottles of beer on the wall."\
.print/"No bottles of beer on the wall,"\
.print/"no bottles of beer."\
.print/"Go to the store and buy some more, 99 bottles of beer on the wall."\

Interpreter for BCT

cmds=1 |Put your commands here.
data=1 |Put your data here.
a=1
.while cmds/a\!""
.if cmds/a\=0:
.replace/data,1,""\
.print/data\
}
.if cmds/a\=1:
.if cmds/1\=1:
.replace/data,.length/cmds\+1,cmds/a+1\\
}
.print/cmds\
a=a+1
}
a=a+1
}
.print(a" iterations done."

Deadfish

cmds=i, i, s, d, o |Put your commands here.
a=0
b=1
.while b<=length/cmds\:
.if cmds/b\=i:
a=a+1
}
.if cmds/b\=d:
a=a-1
}
.if cmds/b\=s:
a=a*a
}
.if cmds/b\=o:
.print/a\
}
b=b+1
}

Fibonacci sequence

a=20 |This variable determines how many Fibonacci numbers to produce.
b=1
c=1
.print/c\
d=1
.while d<a+1:
b=c
c=b+c
.print/c\
}

Self-interpreter

a= Put your code here.
b=1
while b<=.length/a\:
.do/a/b\\
}

Prime calculator

Prints every prime up to a.

primes=2, |Note: NEVER change this variable.
a=50 |This variable determines the number which is the maximum value that a prime can be found at. You can change this variable.
b=3 |Note: NEVER change this variable.
c=1 |Note: NEVER change this variable.
while b<=a:
while c<=.length/primes\:
if b%primes/c\=0:
b=b+1
c=1
}
if b%primes/c\!0:
c=c+1
}
.print/"Prime detected: "b\
.replace/primes,.length/primes\+1,b\
b=b+1
}
.print/"Total number of primes found: "length/primes\\

Text adventure

NOTE: This only works if you stop the program after a line is displayed.

a="down"
b=0,0
.while a!"win":
.if a="xyzzy":
b=3,1
}
.if b=0,0:
.print/"You have entered the mansion. Go: left, right."\
.if a="left":
b=-1,0
}
.if a="right":
b=1,0
}
}
.if b=-1,0:
.print/"Do you choose the left passage or the right passage? Go: up,  right"\
.if a="up":
b=-1,1
}
.if a="right":
b=0,0
}
}
.if b=1,0:
.print/"Do you choose the right passage or the left passage? Go: up, left"\
.if a="up":
b=1,1
}
.if a="left":
b=0,0
}
}
.if b=1,1:
.print/"Go: up, down"\
.if a="up":
b=1,2
}
.if a="down":
b=1,0
}
}
.if b=1,2:
.print/"Go: right, down"\
.if a="right":
b=2,2
}
.if a="down":
b=1,1
}
}
.if b=2,2:
.print/"Go: left, right"\
.if a="left":
b=1,2
}
.if a="right":
b=3,2
}
}
.if b=3,2:
.print/"Go: left, down"\
.if a="left":
b=2,2
}
.if a="down":
b=3,1
}
}
.if b=3,1:
.print/"Go: up, down"\
.if a="up":
b=3,2
}
.if a="down":
b=3,0
a="win"
}
}
.if b=-1,1:
.print/"Go: up, down"\
.if a="up":
b=-1,2
}
.if a="down":
b=0,1
}
.if b=-1,2:
.print/"Go: left, down"\
.if a="left":
b=-2,2
}
.if a="down":
b=-1,1
}
.if b=-2,2:
.print/"Go: left, right"\
.if a="left":
b=-3,2
}
.if a="right":
b=-1,2
}
}
.if b=-3,2:
.print/"Go: down, right"\
.if a="down":
b=-3,1
}
.if a="right":
b=-2,2
}
}
.if b=-3,1:
.print/"Go: down, up"\
.if a="down":
b=-3,0
}
.if a="up":
b=-3,2
}
}
.if b=-3,2:
.print/"Go: up"\
.if a="up":
b=-3,1
}
}
.print/"You win!"\