Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 88 Current »

Boo Keywords

Index

#abstract
#and
#as
#AST
#break
#callable
#cast
#char
#class
#constructor
#continue
#def
#destructor
#do
#elif
#else
#ensure
#enum
#event
#except
#failure
#final
#from
#for
#false
#get
#given
#goto
#if
#import
#in
#interface
#internal
#is
#isa
#not
#null
#of
#or
#otherwise
#override
#namespace
#partial
#pass
#public
#protected
#private
#raise
#ref
#retry
#return
#self
#set
#super
#static
#struct
#success
#transient
#true
#try
#typeof
#unless
#virtual
#when
#while
#yield

Keywords

abstract

"abstract" is used to designate a class as a base class. A derivative of the abstract class must implement all of its abstract methods and properties.

Examples

and

"and" is a logical operator that is applied to test if two boolean expressions are true.

Examples

as

The "as" keyword declares a variables type.

Examples

AST

"AST" is used to create AST objects for use with the Boo compiler.

Examples

break

"break" is a keyword used to escape program execution. Typically break is used inside a loop and may be coupled with the "if" or "unless" keywords.

Examples

callable

"callable" allows function or type to be called by another.

Examples

cast

"cast" is a keyword used to explicitly transform a variable from one data type to another.

Examples

char

"char" is a data type representing a single character. The char data type is distinct from a string containing a single character. char('t') refers to a System.Char type, whereas "t" or 't' is a System.String.

Examples

class

"class" is a definition of an object including its properties and methods.

Examples

constructor

"constructor" is a method belonging to a class that is used to define how an instance of the class should be created. The constructor may include input parameters and may be overloaded.

Examples

see the examples for the keyword "class"

continue

"continue" is a keyword used to resume program execution at the end of the current loop.

The continue keyword is used when looping. It will cause the position of the code to return to the start of the loop (as long as the condition still holds).

Examples

def

"def" is used to define a new function or method.

Examples

destructor

"destructor" is used to destroy objects. Destructors are necessary to release memory used by non-managed resources in the .NET CLI. Desctructors should never be called explicitly. They can be invoked by implementing the IDisposable() interface.

Examples

do

"do" is synonymous with 'def' for closures. However, "do" reads as an imperative and therefore should be used in an active sense.

Examples

Example 1
Example 2

elif

"elif" is similar the same as the "if" conditional statement in form, except that it needs to be preceded by an if statement or another elif statement and that it is only evaluated (checked) if the if/elif statement preceding it evaulates to false.

If one of the preceding if/elifs statements evaluates to true, the rest of the elifs will not be evaluated, thus sparing extra CPU power from a pointless task.

Examples

else

"else" is defines a statement that will be executed should a preceding "if" condition fail.

Examples

ensure

"ensure" is used with the "try" and "except" keywords to guarantee a certain block of code runs whether the try/except block is successful or not. "ensure" is often used to add some post executions to an exception event.

Examples

enum

"enum" is used to create a list of static values. Internally the names are assigned to an Int32 value.

Examples

event

"event" is (insert text here)

except

"except" is keyword use to identify a block of code that is to be executed if the "try" block fails.

Examples

See examples under the "ensure" keyword.

failure

"failure" is not yet implemented in boo.

final

"final" is a keyword used to identify a class that cannot have subclasses. final may also be used to declare a field as a constant.

Examples

Example 1
Example 2

from

"from" is used with the "import" keyword to identify the assembly being imported from. Form usage is "import TARGET (from ASSEMBLY). The "from" keyword is optional.

Examples

for

"for" is used to loop through items in a series. "for" loops are frequently used with a range or a listarray.

Examples

false

"false" represents a negative boolean outcome.

Examples

get

"get" is used to identify a field that is exposed for external access. Use "get" to make a field available as read-only. Use "set" to add write access. "get" is suffixed by a colon when implemented and includes a return statement. It is possible to modify the value of the field being returned. See example 1.

"get" is also used when defining an interface to define which fields should be implemented as accessible. When "get" is used to define an interface the colon and return statements are excluded. See example 2.

Examples

Example 1
Example 2

given

"given" is used as the entry to a "given ... when" loop. "given" identifies a state. A series of "when" statements may be executed based on the identified state. _ The "given" keyword is currently not implemented. _

Examples

Example 1
Example 2

goto

"goto" exits a line of code and moves to a named line in the code. The named line must be prefixed wtih a colon. Good programming practice eschews the use of "goto"

The example below names two lines ":start" and "test". They are referenced in the code by separate goto statements. This example produces an endless loop. The "ensure" statement includes a Console.Readline() that prevents the loop from continuing without user input.

Examples

if

"if" is a conditional statement, followed by a statement that either evaluates to true or false. In block form, the code within the block is executed only if the expression following the if evaluates to true.

The if statement can be used to selectively execute a line of code by placing "if <expression>" at the very end of the statement. This form of the if conditional is useful in circumstances when you are only going to perform one operation based entirely on an expression: this makes the code cleaner to read than an unnecessary if block.

Examples

import

"import" is used to include a namespace from other assemblies within your program. If the assembly is not automatically included, the "from" keyword must be included to identify the respective assembly.

Example

Example 1
Example 2

in

"in" is used in conjunction with "for" to iterate through items in a list. "in" may also be used to test items in a set.

Examples

Example 1

See examples for the keyword "for".

Example 2

interface

"inteface" is used to define the fields and methods that may be implemented by a class. The implementation is never performed by the interface. Interfaces allow you to establish an API that is the basis for other classes.

Examples

internal

"internal" is a keyword that precedes a class definition to limit the class to the assembly in which it is found.

Examples

is

"is" is an equvalence operator keyword that is used to test a value. "is" may not be used with ints, doubles, or boolean types. "is" is commonly used to test for null.

Examples

Example 1
Example 2

isa

"isa" determines if one element is an instance of a specific type.

Examples

Example 1
Example 2

not

"not" is used with "is" to perform a negative comparison. "not" can also be used in logical expressions.

Examples

Example 1
Example 2

null

"null" is a keyword used to specify a value is absent.

Examples

of

"of" is used to specify type arguments to a generic type or method.

Examples

or

"or" is a logical operator that is applied to test if either of two boolean expressions are true.

Examples

otherwise

"otherwise" is part of the conditional phrase "given ... when ... otherwise". The otherwise block is executed for a given state if none of the when conditions match. _ The otherwise keyword is not yet implemented _

Examples

See examples for "given".

override

"override" is used in a derived class to declare that a method is to be used instead of the inherited method. "override" may only be used on methods that are defined as "virtual" or "abstract" in the parent class.

Examples

namespace

"namespace" is a name that uniquely identifies a set of objects so there is no ambiguity when objects from different sources are used together. To declare a namespace place the namespace followed by the name you choose at the top of the file.

Examples

partial

"partial" is (insert text here)

pass

"pass" is a keyword used when you do not want to do anything in a block of code.

Examples

Example 1
Example 2

public

"public" is used to define a class, method, or field as available to all. "public class" is never required because a defined class defaults to public.

Example

Example 1
Example 2

protected

"protected" is a keyword used to declare a class, method, or field as visible only within its containing class. Fields are by default protected. Prefixing a field name with an underscore  is recommended practice.

Examples

Example 1
Example 2

private

"private" is keyword used to declare a class, method, or field visible within only its containing class and inherited classes..

Examples

Example 1
Example 2
Example 3

raise

"raise" is (insert text here)

ref

"ref" makes a parameter be passed by reference instead of by value. This allows you to change a variable's value outside of the context where it is being used

Examples

retry

"retry" is not yet implemented.

return

"return" is a keyword use to state the value to be returned from a function definition

Examples

Example 1
Example 2

self

"self" is used to reference the current class. "self" is not required for boo but may be used to add clarity to the code. "self" is synonymous with the c# keyword "this".

Examples

set

"set" is a keyword used to define a field as writeable.

Examples

static

"static" is (insert text here)

struct

"struct" is short for structure. A structure is similar to a class except it defines value types rather than reference types.

Refer to the Boo Primer for more information on structures.

Examples

success

"success" is not yet implemented.

super

"super" is used to reference a base class from a child class when one wants to execute the base behavior.

Examples

transient

"transient" transient marks a member as not to be serialized. By default, all members in Boo are serializable.

Examples

true

"true" is keyword used to represent a positive boolean outcome.

Examples

try

"try" is used with the "ensure" and "except" keywords to test whether a block of code executes without error.

Examples

typeof

typeof returns a Type instance. Unnecessary, in Boo since you can pass by type directly.

Examples

unless

"unless" is similar to the "if" statement, except that it executes the block of code unless the expression is true.

Examples

virtual

"virtual" is a keyword that may precede the 'def' keyword when the developer wishes to provide the ability to override a defined method in a child class. The 'virtual' keyword is used in the parent class.

Examples

when

"when" is used with the "given" keyword to identify the condition in a which the "given" value may be executed. _b "when" is currently not implemented.

Examples

see examples for the "given" keyword.

while

"while" will execute a block of code as long as the expression it evaluates is true.

It is useful in cases where a variable must constantly be evalulated (in another thread, perhaps) , such as checking to make sure a socket still has a connection before emptying a buffer (filled by another thread, perhaps).

Examples

yield

"yield" is similar to "return" only it can be called multiple times within a single method.

Examples

  • No labels