Skip to content

Commit

Permalink
Create SilkLanguage.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftCircuits authored May 16, 2021
1 parent d31a4c0 commit 7cc8a9e
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions docs/SilkLanguage.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,6 @@ doSomething()

Note that global variables are not initialized at runtime. Instead, the compiler stores the value of global variables with the `CompiledProgram` and the global variables are already initialized when the runtime loads the program. Contrast this to local variables, which must be initialized at runtime.

## Loops

Silk supports `for` and `while` loops. Curly braces are required around the loop body when the body has more than one statement.

```cs
for i = 1 to 100
printline i
```

```cs
i = 1
while i <= 10
{
printline i
i = i + 1
}
```

Silk supports the `break` and `continue` keywords. Use `break` to exit the current loop. Use `continue` to immediately start the next iteration of the current loop. Loops can be nested.

## Lists (Arrays)

Silk also supports lists. There are two ways to create a list. The first way is using square brackets to specify the size of the list.
Expand Down Expand Up @@ -198,9 +178,9 @@ A line comment is signifies by two forward slashes (`//`). The forward slashes a
Multiline Comment
A multiline comment starts with a forward slash and asterisk (`/*`) and ends with an asterisk and forward slash (`*/`). These delimiters and anything that appears between them will be considered a comment and ignored by the compiler.

## Structures
## Flow Control

The Silk language supports a number of standard language structures.
The Silk language supports several constructs to control the flow of execution.

#### If

Expand Down Expand Up @@ -267,6 +247,8 @@ main()
}
```

Both `while` and `for` loops can contain the `break` and `continue` keywords. Use `break` to exit the current loop and start execution at the next line after the loop. Use `continue` to jump to the next iteration of the current loop.

## Operators

Silk supports the following operators.
Expand Down

0 comments on commit 7cc8a9e

Please sign in to comment.