WTF

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

WTF is a concept by User:H33T33 and friend

WTF is designed to be incredibly annoying and time-consuming to use. It is very similar to C, but there are some slight differences that make it feel unusual to program in.

Overview

Commands

Command Description Example(s) Output
Printf(...); Outputs a given value Printf("abc"); abc
If(condition){...}; If a given condition is non-zero, the code block runs.
If(1){
  Printf("abc");
 };
abc
Elseif(condition){...} Checks the condition and runs the code within the code block if the previous If/Elseif statement had a false condition
If(0){
    Printf("Hello, world!");
 }Elseif(1){
    Printf("Goodbye.");
  };
Goodbye.
Else{...} Runs the code within the code block if the previous If/Elseif statement had a false condition
If(0){
    Printf("Hello, world!");
 }Else{
    Printf("Goodbye.");
  }
Goodbye.
For(var;condition){...}; Loops through the contents of the code block for as long as the condition is true
For(int int i=0; 3>int i){
  int i = 1 + int i;  
   Printf("abc");
 };
abcabcabc
While(condition){...};
Loops through the contents of the code block for as long as the condition is non-zero
While(1){
  Printf("abc");
 };
abcabcabcabc...
Enum{...}; Used to define constant integer variables
Enum{
  a,
   b,
  c
 }

Variables

Variables must not only be assigned a data type, but they must also be named and called with the assigned data type ᛃ For example:

  • datatype var; in C would be datatype datatype var; in WTF
  • Calling a variable in C would be var;, while in WTF it would be datatype var;
Data Types Description Example(s)
Int Integer Value Int Int var;
Char Character Value Char Char var;
Float Fractional Value Float Float var;
Double Larger Fractional Value Double Double var;
Long Increases size of int or double data type Long Long var;
Null Void Value Null Null var;
Pointer "Points" to the location of a variable Pointer Int Int var;
Immutable Constant Value Immutable Int Int var;
Inaccessible Local Value
  • Cannot be used outside of the code block it was declared/initialized in
Inaccessible Int Int var;
Untransferable "Pointer-proof" Value
  • Cannot be pointed to
Untransferable Int Int var;

Other Keywords

Keyword Description
VOID Null Value

Rules and whatnot

Logical Operators

var==1 in C would be written as 1==var in WTF.

If(1==var){
  Printf("Hello, world!");
};

Mathematical Operators

Incrementation/Decrementation does not exist. var++; or var=var+1; in C would be written as int var=1+int var in WTF.

int int var=0;
 int var = 1 + int var;

Indentation

Single Lines

The indentation of each line must differ from the line before it:

Printf("Hello,");
 Printf(" world! ");
Printf("Goodbye.");

Arrays and Functions

The ending curly brackets cannot have the same indentation as the beginning of the function/array definition

Null Null Func(){
  Printf("abc");
 }

Char Char List[] = {
  'a',
   'b',
  'c'
 };

Extra/Uncategorized

Enum

In C, any undefined constants ahead of a defined constant would, in this case, continue from 3 (b=4, c=5, etc). In WTF, no matter what value a defined constant is, any undefined constants, whether they come before or after the defined constant, will be assigned their index in the enum (b=1, c=2 even though a=3)

Enum vals{
  a=3,
   b,  // b=1
  c    // c=2
 }

As much as this looks like it would be a joke language, it most certainly is not.

It's still better than Java