PROGRAM Part10 { }
var x, y : integer;
var s : real;
var c : string;
var f : boolean;
var a1 : integer = 5;
var c, s : string = "same values"
x = 1 * 2 + 3 - 4 / 5 * (1 + 2)
f = true;
s = 1.5;
c = "My language"
flag = True and False or !False and (True and False)
flag = 1 < 2 and 2 > 1
function foo(s: STRING) {
VAR c : STRING;
}
function foo(s: STRING) {
...
print(s)
function bar() {
return 2;
}
return bar();
}
print(foo("bar")); // prints 2
foo("Custom" + " " + "language");
x = 10
if x > 5
{
print("x is greater than 5");
}
elif x < 5
{
print("x is less than 5")
}
else
{
print("x equals to 5")
}
if true or false
{
print("true")
}
if true and !false
{
print("true")
}
for i = 0; i < 10; i = i + 1 {
for j = 0; j < 10; j = j + 1 {
for k = 0; k < 10; k = k + 1 {
print(i * j * k)
}
}
}
// This is one line comment
{{
This is multi-line comment
}}
PROGRAM Part10
{
function fib(n: int) {
if n < 1 {
return 0;
}
elif n < 3 {
return 1;
}
return fib(n - 1) + fib(n - 2);
}
for i = 0; i < 10; i = i + 1 {
print(fib(i));
}
}