Star Script

Simplify Web Application Development

Introducing Star Script (6): Basic Examples 3

Example: Condition

if 2 > 1 then
  hey, "2 > 1"
end
hey, 2 > 1

Example: Multiple Branch Condition

if 1 > 2 then
  Oops! "1 > 2" ???
elseif 2 > 1 then 
  right "2 > 1"
end
right 2 > 1

Example: Function

func sum(n as int)
  var s = 0
  for i = 1 to n
    s = s + i
  next
  return s
end
sum(10)
55
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: