Harbour (programming language): Difference between revisions

Content deleted Content added
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Line 116:
 
Complex Types may also be represent as literal values:
* Array: <sourcesyntaxhighlight lang=visualfoxpro enclose=none>{ "String", 1, { "Nested Array" }, .T., FunctionCall(), @FunctionPointer() }</sourcesyntaxhighlight>
* [[CodeBlock]]: <sourcesyntaxhighlight lang=visualfoxpro enclose=none>{ |Arg1, ArgN| Arg1 := ArgN + OuterVar + FunctionCall() }</sourcesyntaxhighlight>
* Hash: <sourcesyntaxhighlight lang=visualfoxpro enclose=none>{ "Name" => "John", 1 => "Numeric key", { "Nested" => "Hash" } }</sourcesyntaxhighlight>
Hashes may use ''any'' type including other Hashes as the ''Key'' for any element. Hashes and Arrays may contain ''any'' type as the ''Value'' of any member, including nesting arrays, and Hashes.
 
Line 251:
An example procedure definition and a function call follows:
 
<sourcesyntaxhighlight lang="visualfoxpro">
x := Cube( 2 )
 
FUNCTION Cube( n )
RETURN n ** 3
</syntaxhighlight>
</source>
 
===Sample code===
The typical "[[hello world]]" program would be:
<sourcesyntaxhighlight lang="visualfoxpro">
? "Hello, world!"
</syntaxhighlight>
</source>
Or:
<sourcesyntaxhighlight lang="visualfoxpro">
QOut( "Hello, world!" )
</syntaxhighlight>
</source>
Or:
<sourcesyntaxhighlight lang="visualfoxpro">
Alert( "Hello, world!" )
</syntaxhighlight>
</source>
Or, enclosed in an explicit procedure:
 
<sourcesyntaxhighlight lang="visualfoxpro">
PROCEDURE Main()
 
Line 279:
 
RETURN
</syntaxhighlight>
</source>
 
====OOP examples====
Main procedure:
<sourcesyntaxhighlight lang="vfp">
#include "hbclass.ch"
 
Line 299:
 
RETURN
</syntaxhighlight>
</source>
Class definition:
<sourcesyntaxhighlight lang="text">
CREATE CLASS Person
 
Line 340:
 
RETURN cDescription
</syntaxhighlight>
</source>
 
==Tools==