Draft:K Sharp (programming language)

K# is a interpreted programming language syntacally to V# or C# by me.

My project is on Discord and GitHub. Take a look!

Syntax

So my language is buggy, but this is how it should work:

Example Meaning
var a = 1; Variable "a" = 1
var a = b; Variable "a" = variable "b"
var a = b + 1; Variable "a" = variable "b" plus 1
a += 1; Change variable "a" by 1
a /= 2; Divide in-place variable "a" by 2
var a = "hello, world!"; Variable "a" = "Hello, world!"
<syntaxhighlight lang="c#">

func a() {

   var b = 1;

} </syntaxhighlight>

Initialize function a() with no parameters. To call a() we use a();
<syntaxhighlight lang="c#">

func a(b) {

   var c = b;

} </syntaxhighlight>

Initialize function a() with required parameter b. To call a() we use a(somevalue);
<syntaxhighlight lang="c#">

func b(a, c=3) {

   a += c;

} </syntaxhighlight>

Initialize function a() with required parameter b and optional parameter c. To call a() we use a(somevalue, somevalue1); or a(somevalue);
<syntaxhighlight lang="c#">

func c() {

   return 12;

} </syntaxhighlight>

Initialize function a() with return value 12. To call a() we use a();Also to get a function's value we use a()
<syntaxhighlight lang="c#">

var a = 1; var b = 2; if (a == b) {

   b = 3;

} </syntaxhighlight>

An if statement
<syntaxhighlight lang="c#">

var a = 10; var b = 0; while (b < 10) {

   b += 1;

} </syntaxhighlight>

A while statement
execp("print("a")"); execp is "execute in python". The syntax here is somehow not readable, but I think it's "print(" + a + ")"

But this is the answer And same for calling functions ig to have var b on print() we use print("b");. I don't know if theres a better way to do this but this is the answer.

evalp("input(\"What's ur name? \")");
evalp is "eval in python". The syntax here is somehow not readable.

But this is the answer

using "mymodule.ks"; Import a file called "mymodule.ks" to program.

References