Skip to content

Commit

Permalink
Merge pull request #5662 from MaryamZi/fix-bbes-u10
Browse files Browse the repository at this point in the history
Fix several issues in BBEs
  • Loading branch information
MaryamZi authored Sep 23, 2024
2 parents 107cda1 + 3f3b6c0 commit b6d3034
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/boolean/boolean.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Boolean

The `boolean` type has two values: `true`, `false`. The `!` operator works on booleans only. `&&` and `||` operators short-circuit as in C. Usual comparison operators (`==`, `!=`, `<`, `>`, `<=`, and `>=`) produce boolean values.
The `boolean` type has two values: `true`, `false`. The `!` operator works on booleans only. `&&` and `||` operators short-circuit - the second operand is not evaluated if the result of evaluating the first operand is sufficient to identify the result of the logical expression. Usual comparison operators (`==`, `!=`, `<`, `>`, `<=`, and `>=`) produce boolean values.

::: code boolean.bal :::

Expand Down
2 changes: 1 addition & 1 deletion examples/floating-point-numbers/floating_point_numbers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Floating point numbers

The `float` type is IEEE 64-bit binary floating point (same as `double` in Java) and supports the same arithmetic operators as `int`.
The `float` type is IEEE 64-bit binary floating point and supports the same arithmetic operators as `int`.

::: code floating_point_numbers.bal :::

Expand Down
2 changes: 1 addition & 1 deletion examples/integers/integers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Integers

The `int` type is 64-bit signed integers (same as `long` in Java) and supports the usual arithmetic operators: `+ - / %`. The operator precedence is same as C. Integer overflow is a runtime error in Ballerina.
The `int` type is 64-bit signed integers and supports the usual arithmetic operators: `+ - / %`. Integer overflow is a runtime error in Ballerina.

::: code integers.bal :::

Expand Down
6 changes: 3 additions & 3 deletions examples/match-statement/match_statement.bal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ballerina/io;

const switchStatus = "ON";
const SWITCH_STATUS = "ON";

function matchValue(any val) returns string {
// The value of the `val` variable is matched against the given value match patterns.
Expand All @@ -15,7 +15,7 @@ function matchValue(any val) returns string {
"STOP" => {
return "STOP";
}
switchStatus => {
SWITCH_STATUS => {
return "Switch ON";
}
// Use `_` to match type `any`.
Expand All @@ -30,6 +30,6 @@ public function main() {
io:println(matchValue(1));
io:println(matchValue(2));
io:println(matchValue("STOP"));
io:println(matchValue(switchStatus));
io:println(matchValue(SWITCH_STATUS));
io:println(matchValue("default"));
}
2 changes: 1 addition & 1 deletion examples/match-statement/match_statement.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Match statement

`match` statement is similar to `switch` statement in `C` and `JavaScript`. It matches the value, not the type. `==` is used to test whether left hand side matches the value being matched. Left hand side can be a simple literal (`nil`, `boolean`, `int`, `float`, `string`) identifier referring to a constant.
`match` statement is similar to `switch` statement in some other languages. It matches the value, not the type. `==` is used to test whether the left hand side matches the value being matched. The left hand side can be a simple literal (`nil`, `boolean`, `int`, `float`, `string`) identifier referring to a constant.

Left hand side of `_` matches if the value is of type `any`. You can use `|` to match more than one value.

Expand Down
7 changes: 6 additions & 1 deletion examples/open-records/open_records.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Open records

A record type that uses either the `{` and `}` delimiters or the `{|` and `|}` delimiters with a rest descriptor is considered open. They allow fields other than those specified. The type of unspecified fields is `anydata`. Open records belong to `map<anydata>`. Quoted keys can be used to specify fields that are not mentioned in the record type.
A record type that uses either the `{` and `}` delimiters or the `{|` and `|}` delimiters with a rest descriptor is considered open. Open records allow fields other than those explicitly specified.

When the record is open due to the use of the `{` and `}` delimiters, the expected type for any additional field is `anydata`. When the record is open due to the use of a rest descriptor, the expected type for any additional field is the type specified in the rest descriptor.

Quoted keys can be used to specify fields that are not explicitly specified in an open record type.

::: code open_records.bal :::

Expand All @@ -10,3 +14,4 @@ A record type that uses either the `{` and `}` delimiters or the `{|` and `|}` d
- [Records](/learn/by-example/records/)
- [Controlling openness](/learn/by-example/controlling-openness/)
- [Maps](/learn/by-example/maps/)
- [Anydata type](/learn/by-example/anydata-type/)
2 changes: 1 addition & 1 deletion examples/type-definitions/type_definitions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Type definitions

A type definition gives a name for a type. Its name is just an alias for the type, like `typedef` in C.
A type definition gives a name for a type. The name is just an alias for the type.

::: code type_definitions.bal :::

Expand Down
4 changes: 3 additions & 1 deletion examples/xml-access/xml_access.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ It is possible to access elements in XML.

- `x.id` accesses the required attribute named `id`: the result is an error if there is no such attribute or if `x` is not a singleton.

- `x?.id` accesses an optional attribute named `id`: the result is `()` if there is no such attribute. The `lang.xml` langlib provides the other operations.
- `x?.id` accesses an optional attribute named `id`: the result is `()` if there is no such attribute.

The `lang.xml` langlib provides the other operations.

::: code xml_access.bal :::

Expand Down

0 comments on commit b6d3034

Please sign in to comment.