Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Falcon-tut] Falcon says "Hello"
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DarkRider




PostPosted: Mon Feb 09, 2009 12:01 am   Post subject: [Falcon-tut] Falcon says "Hello"

Why should you care what Falcon has to say? Because Falcon is very powerful and has a lot to offer! Falcon emodies the best of six worlds and thus needs a way to talk to you to show off its power!

Lets see how Falcon says hello!

Helllo from Falcon!

Falcon:
printl( "Hello noble human!" )

The printl command accepts any number number of values separated by a comma (",") and outputs them one after another followed by a new line. Equivilant to Ruby's "puts" command, Turing's "put" command and Java's "System.out.println" command.

Like Ruby's "puts" command, printl will only output a new line ("\n") if one is not already included as the last character in the parameter list. So an equivilant example to the one above would be:

Falcon:
printl( "Hello noble human!\n" )

Falcon can also output data without attaching a new line character to the end. Falcon uses the "print" command for this:

Falcon:
print( "Hello noble human!" )
print( " ")
print( "My name is Falcon!" )

Data outputed using print will be outputted on the same line until a new line character is reached (this includes the printl command).

Falcon quickly says "Hello!"

Falcon has an alternative, quicker, version of the print commands. These are the ">" and ">>" operators respectively:

Falcon:
//Two frontslashes represent a line comment

//Outputs data followed by a new line
> "Hello noble human!"

//Outputs data without attaching a new line
>> "Hello noble human!"
>> " "
>> "My name is Falcon!"

Although short, these operators are not usable with the functional aspects of Falcon.

Falcon would like to address you by name

Falcon is very noble and thus knows how to properly address another being. Lets introduce ourselves to Falcon!

Falcon:
> "Hello Falcon!"
>> "My name is "
name = input ()
> @ "Hello $(name)!"

The first second lines should look familiar. The third line simply retrieves input from the user and stores it in a variable called "name."

The fourth line should look a little familiar. The "@" tells Falcon that the following string contains a variable and is to be included into the string. Inside the string, the "$(name)" tells Falcon that you want to insert the value of name into the string. The paranthesis ("()") are optional, your code will compile the same with or without them.

These are basic examples of what you can do with input and output in Falcon. There are more powerful ways of dealing with such functionality.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: