Share your repls and programming experiences

← Back to all posts
My Computer Language -- XWork 0.0.1 V1
aguy11 (119)

Why so many versions?? Because this is the first version of the beginning version, which when released, will actually qualify for a 'good computer language' with functions, loops, etc.

XWork 0.0.1 V1

Following @DynamicSquid's 'Night', I am proud to present 'XWork', a language that works.

How to use/Docs

This can also be found in the README, along with some extra info, but if you want/have to see it here, you can also view it here:

Variable Declaration

This is pretty easy, I say... It can be done like this:

dec (Var Name) -=- (Var Value);

So, an example var would look like this:

dec name -=- "John Cozilac";

You can also redo the variables, like this:

dec age = 10;
age = 11;

Note: There are currently the following types of vars in XWork:

  • String
  • Integer
  • Float

Displaying Messages

In XWork, anything starting with an X is reffering to the terminal, or output. The most basic form of output is X.Add, which can display messages to the screen. Here are some examples with output:

X.Add "Hello Jeff. Would you like some pizza?";

Output:
Hello Jeff. Would you like some pizza?

Another example:

dec name -=- "Mary";
X.Add name;

Output:
Mary

Two more examples:

dec xwork -=- "Computer Language ";
X.Add xwork + "Oh, wow, great!";
X.Add "Blah, Blah, Blah " * 7 + "That a spicy meatball";
X.Add xwork == "Not a coumputer language";

Output:
Computer Language Oh, wow great!
Blah, Blah, Blah Blah, Blah, Blah Blah, Blah, Blah Blah, Blah, Blah Blah, Blah, Blah Blah, Blah, Blah Blah, Blah, Blah That a spicy meatball
False

User Input

In XWork, user input is pretty easy... Take a look:

dec username -=- X.AskStr "What is your username?";
dec password -=- X.AskInt "What is your password?";

Note: You can also use X.AskFloat for float level inputs

If, elif, else statements

In XWork, if statements are a mix of Python and C++. They look somewhat like this:

dec name -=- X.AskStr "What is your name? ";
checkFor name == "Jeff" {
  X.Add "Why welcome, Jeff!";
}
elseCheck name == "Bill" {
  X.Add "Hello Bill!";
}
elseDo {
  X.Add "Hello " + name  + "!"; 
}

Some things to know:

  • checkFor is if
  • elseCheck is elif
  • elseDo is else
  • The contents of the case are stored in a {}
  • The cases support and and or
  • The cases support all common operators(==, <=, >)

Limits

Some current limits:

  • Strings only surrounded by "s not 's
  • No Comments

How to use:

1) Fork the repl
2) Change the stuff inside test.xw
3) Click 'Run', and see your results!

If someone can create a logo for this, please do! I was thinking about, maybe a computer with some code on it? Dunno. Just, something that symbolizes code, and work... maybe add an 'X' to it too.

Commentshotnewtop
LoganSpong (45)

Awesome name & syntax! Upvote.