Category:Night: Difference between revisions

Updated the Night description
m (added language stub.)
(Updated the Night description)
Line 1:
{{language|Night}}
 
'''Night''' is an interpreted programming language made by [https://www.github.com/DynamicSquid DynamicSquid] that combinesfocuses theon simplicity ofand [https://wwwusability.python.org Python]The withmain thegoal typeof conceptsNight ofis theto Cdesign family.an Itsintuitive officialand websitesafe is [https://night-weblanguage.dynamicsquid.repl.co here]It's anddynamically thetyped sourceand code is [https://github.com/DynamicSquid/Night here]semi-weak.
 
What makes Night differ from other dynamically typed languages is its compile time checking. Whereas a language like Python wouldn't type check a variable, nor check if a variable even exists or not at compile time, Night fills this gap, eliminating hidden runtime bugs and providing a more reliable usage.
== Built-in functions ==
Right now the only built-in function is <code>print</code>, similar to C's <code>printf</code>. It takes a string as an argument and prints it to the screen (like C, but unlike Python, without a newline).
== Types ==
The types are:
* integers (<code>int</code>)
* floating points (<code>dec</code>)
* booleans (<code>bit</code>)
* characters (<code>syb</code>)
* string (<code>str</code>)
== Examples ==
Here is the example used on the [https://github.com/DynamicSquid/Night GitHub page] (slightly modified):
<lang night>print("Hello World!\n");
 
Also note that Night is still fairly new in the development process.
// this is a comment
bit boolean = true;
syb character = 'c';
int integer = 10;
dec float = 3.14;
str string = "squid";
 
int answer = 10 + 5;
answer = 2 + 3;
int legs = 10;
bit smart = true;
if (legs == 10 && smart) {
print("Hi squid\n");
}
else if (legs == 8 && smart) {
print("Hi octopus\n");
}
else if (legs == 2 && !smart) {
print("Hi human\n");
}
else {
print("Not sure who you are\n");
}
int add(int a, int b) {
print("Adding to numbers:\n");
return a + b;
}
 
int number = add(2, 3) + 4;
print(number + "\n");</lang>
Output:
<lang night>Hello world!
Hi squid
Adding to numbers:
9</lang>