LoopScript-

From Esolang
Jump to navigation Jump to search

LoopScript- (LS-) is a variant of LS that doesn't have the -n command and changes the (...)n command (and uses [...]n instead)

commands:

+n adds one to var n
%n set var n to input
$n print var n
[...]n while(n != 0) loop but ]n would be -n)n in LS

optional:

?n set var n to random int in set {1,...,n}

Programs

Cat program

+1[%2$2+1]1

Truth machine

%1$1[$1+1]1

n mod 2

%1[+2[[]2]3[+3]2]1$3

Fibonacci sequence

%1+2[[+4]2[+2+4]3[+3]4]1$3

not a

%1+0[[]0]1$0

a or b

%1%2[+3]1[+3]2[+0[]3+3]3$0

a and b

%1%2[[+0]1]2$0

a xor b

%1%2[+1]2[+2[[]2]0[+0]2]1$0