Cable

From Esolang
Jump to navigation Jump to search

Cable is a name of a programming language created by user User:RainbowDash in 2026. Where instructions are read from the left, and appended to the left. Instructions take the form of blocks.

Cable
Designed by RainbowDash
Appeared in 2026
Memory system Variables
Computational class Turing complete
Reference implementation Python
File extension(s) .cable

Blocks

There are several blocks in the programming language.

  • [A = 0] - Variable assignment.
  • [Print "Hello world"] - Prints a string.
  • [Delete] - Deletes the block in front of it.
  • [If A == B] - Deletes the block in front of it if the value is false.
  • [Integer A] - Converts variable A to a Integer.
  • [Upper A] - Uppercases A if it is a string.
  • [Lower A] - Lowercases A if it is a string.
  • [Duplicate A] - A can be a variable or an integer. This duplicates the block in front of it by A times.
  • [Newline] - Prints a newline, this is used instead of \n in strings because it looks nicer.
  • [Append [BLOCK][BLOCK][BLOCK]] - Appends blocks to the left of the program.

Variable Assignment

Variables are stored by their names, they are case senstive.

[A = 5]
[B = 2]
[A += 5]
[A -= B]

The operators += -= *= //= %= are all allocated to you. You can also do

[A = A==(B+1)]

and other similar expressions.

Appending, Duplicating, If statements and Deleting

Appending

The append instruction, appends blocks to the left.

[Append [Print "Hello"]][Print " World"]

So this would append [Print "Hello"] to the left and become

[Print "Hello"][Print " World"]

Which when executed would print "Hello World".

Duplicating

Similar to appending, duplicate creates more blocks.

[A = 5]
[Duplicate A][Print "*"][Print "Wow"]

would become

[Print "*"][Print "*"][Print "*"][Print "*"][Print "*"][Print "Wow"]

Which when executed would print "*****Wow". Similarly a value can be hardcoded to execute the same thing.

[Duplicate 5][Print "*"][Print "Wow"]

If you would want to add a newline, you can use append to do so. This allows for multiple blocks to be duplicated because it is duplicating the "Append" block.

[Duplicate 5][Append [Print "*"][Newline]][Print "Wow"]

Deleting

Rather than duplicating or appending, delete as it's name suggests deletes the block ahead of it, with no arguments.

[Delete][Print "Hello world"]

this would not print anything because the block ahead of it would be deleted.

If statements

If statements are similar to delete in the sense it removes the block ahead of it. However it only deletes the block ahead of it, if the statement is false.

[A = 5][B = 5]
[If A == 5][Print "A and B are equal to each other"]
[If A != 5][Print "A and B are not equal to each other"]

One prints if the statement is true and the other prints if the statement is false.

String operations

There are a few operations you can do in this language. Such as printing.

[A = 5]
[B = 5]
[Print "Your value is " + A + "."] # Prints Your value is 5.
[Print (A == 5)] # Prints 1
[Print A+B] # Prints 55
[Print (A+B)] # Prints 10

[A = "Good"]
[B = " dog"]
[Print A+B] # Prints Good dog
[A = A+B]
[Print A] # Prints Good dog

While loops

Cable has no native loop construct. Loops are created by re-inserting code into the program.

[A = 1]
[Duplicate][Append [Code blocks][If A == 10][Delete][Duplicate]]

Where you can replace [Code blocks] with something like [Print A][A += 1][Newline] and it will create a counter from 1 to 10.

Implementation

Cable/Implementations

See Also