Draft:K Sharp (programming language): Difference between revisions
Undid revision 1246821453 by Kin1009 (talk) |
(No difference)
|
Latest revision as of 12:36, 21 September 2024
![]() | Draft article not currently submitted for review.
This is a draft Articles for creation (AfC) submission. It is not currently pending review. While there are no deadlines, abandoned drafts may be deleted after six months. To edit the draft click on the "Edit" tab at the top of the window. To be accepted, a draft should:
It is strongly discouraged to write about yourself, your business or employer. If you do so, you must declare it. This draft has not been edited in over six months and qualifies to be deleted per CSD G13.
Where to get help
How to improve a draft
You can also browse Wikipedia:Featured articles and Wikipedia:Good articles to find examples of Wikipedia's best writing on topics similar to your proposed article. Improving your odds of a speedy review To improve your odds of a faster review, tag your draft with relevant WikiProject tags using the button below. This will let reviewers know a new draft has been submitted in their area of interest. For instance, if you wrote about a female astronomer, you would want to add the Biography, Astronomy, and Women scientists tags. Editor resources Last edited by 5.139.232.128 (talk | contribs) 7 months ago. (Update) |
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 | |
evalp("input(\"What's ur name? \")");
|
| |
using "mymodule.ks";
|
Import a file called "mymodule.ks" to program. |