Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated README #139

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,25 @@ var a = 10
var b = 20
print(a + b) # 30

var c = "Hello"
var d = "World"
c = "Hello"
d = "World"
print(c + " " + d) # Hello World

# Conditional statement
if a > b {
if a > b
{
print("a is greater than b")
} elif a < b {
}
elif a < b {
print("a is less than b")
} else {
}
else
{
print("a is equal to b")
}

# For loop
var x = 9 # Multiplication table of 9
x = 9 # Multiplication table of 9

for i = 1 to 11 {
print(str(x) + " X " + str(i) + " = " + str(x * i))
Expand All @@ -176,7 +180,7 @@ fun add(a, b) {
print(add(10, 20)) # 30

# Anonymous function
var sub = fun (a, b) {
sub = fun (a, b) {
return a - b
}

Expand All @@ -189,7 +193,7 @@ print(mul(10, 20)) # 200
# Class definition
class Person {
# Constructor
fun Person(name, age) {
fun __constructor__(name, age) {
var this.name = name
var this.age = age
}
Expand All @@ -204,13 +208,13 @@ class Person {
}

# Use a class
var person = Person("Almas", 21)
var details = "Name is : " + person.get_name() + ", Age : " + str(person.get_age())
person = Person("Almas", 21)
details = "Name is : " + person.get_name() + ", Age : " + str(person.get_age())
print(details)

# Include statement
include Math # to include math library
include "examples/simple.rn" # to use a path
# Import statement
import Math # to include math library
import "examples/simple.rn" # to use a path

# builtin functions

Expand All @@ -222,9 +226,6 @@ exit()
# same as include statement
require()

# Command line arguments
sys_args()

# API methods
pyapi(string)

Expand Down