NIP

From Esolang
Jump to navigation Jump to search

NIP is an esoteric programming language. The creator of this language looked at the C for loop structure, and then began to wonder whether everything can be put inside it.

Syntax

Just as what is refers to, all of the code gets put inside a for loop. Here is an example program:

;
printf("Hello, world\n");
0;

The first line of this program declares variables, for example a, b, c;. They get put inside the parameters of the main function.

The second line of this program declares what gets put into the first parameter(a) of the for loop. for(a;b;c);

The third line puts the line to parameter b.

The fourth line(without a semicolon) gets out into c;

Example programs

Hello, world! program

;
printf("Hello, world\n");
0;

Add from 1 to 100

s, i;
i = 1;
i <= 100;
s += i,
	++ i

Simple looping adder

a, b, c;
scanf("%d", &c);
scanf("%d %d", &a, &b) == 2;
printf("%d\n", a + b)