C Sharp to Boo

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
Line 15: Line 15:
  
 
<nowiki># Lists</nowiki>   
 
<nowiki># Lists</nowiki>   
:myList1 as List
+
<syntaxhighlight lang="boo">
:myList2 as List = List() # instantiates new List object   
+
myList1 as List
:myList3 as List = List(1, 2, 3)   
+
myList2 as List = List() # instantiates new List object   
:myList.Add(4)
+
myList3 as List = List(1, 2, 3)   
 +
myList.Add(4)
 +
</syntaxhighlight>
  
 
<nowiki># Queues</nowiki>
 
<nowiki># Queues</nowiki>
:myQueue as Queue
+
<syntaxhighlight lang="boo">
:myQueue as Queue = Queue()
+
myQueue as Queue
:myQueue.Enqueue(1)
+
myQueue as Queue = Queue()
:myQueue.Peek()
+
myQueue.Enqueue(1)
:myQueue.Dequeue()
+
myQueue.Peek()
 +
myQueue.Dequeue()
 +
</syntaxhighlight>

Revision as of 06:26, 6 February 2013

Finding the difference in C# and Boo can be trying at the best of times. So hopefully there is something here to help you use Boo.

Variable definition:

var1 as int
var2 as int = 2  
var3 as single = 1.0 # single precision floating point number  
var4 as double = 2.2342352 # double precision floating point number

Collections:

import System.Collections

# Lists

myList1 as List
myList2 as List = List() # instantiates new List object  
myList3 as List = List(1, 2, 3)  
myList.Add(4)

# Queues

myQueue as Queue
myQueue as Queue = Queue()
myQueue.Enqueue(1)
myQueue.Peek()
myQueue.Dequeue()
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox