Skip to content

Commit

Permalink
Replace "." for ":" the lines that were missing it before code blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandraPedroza committed Apr 12, 2024
1 parent 49d3757 commit 627adee
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions docs/topics/basic-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ by JetBrains Academy.

## Package definition and imports

Package specification should be at the top of the source file.
Package specification should be at the top of the source file:

```kotlin
package my.demo
Expand All @@ -24,7 +24,7 @@ See [Packages](packages.md).

## Program entry point

An entry point of a Kotlin application is the `main` function.
An entry point of a Kotlin application is the `main` function:

```kotlin
fun main() {
Expand All @@ -33,7 +33,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-hello-world"}

Another form of `main` accepts a variable number of `String` arguments.
Another form of `main` accepts a variable number of `String` arguments:

```kotlin
fun main(args: Array<String>) {
Expand All @@ -44,7 +44,7 @@ fun main(args: Array<String>) {

## Print to the standard output

`print` prints its argument to the standard output.
`print` prints its argument to the standard output:

```kotlin
fun main() {
Expand All @@ -56,7 +56,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-print"}

`println` prints its arguments and adds a line break, so that the next thing you print appears on the next line.
`println` prints its arguments and adds a line break, so that the next thing you print appears on the next line:

```kotlin
fun main() {
Expand All @@ -70,7 +70,7 @@ fun main() {

## Functions

A function with two `Int` parameters and `Int` return type.
A function with two `Int` parameters and `Int` return type:

```kotlin
//sampleStart
Expand All @@ -86,7 +86,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-return-int"}

A function body can be an expression. Its return type is inferred.
A function body can be an expression. Its return type is inferred:

```kotlin
//sampleStart
Expand All @@ -99,7 +99,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-function-expression"}

A function that returns no meaningful value.
A function that returns no meaningful value:

```kotlin
//sampleStart
Expand All @@ -114,7 +114,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-return-unit"}

`Unit` return type can be omitted.
`Unit` return type can be omitted:

```kotlin
//sampleStart
Expand Down Expand Up @@ -229,20 +229,20 @@ For information about declaring properties, see [Properties](properties.md).

## Creating classes and instances

To define a class, use the `class` keyword.
To define a class, use the `class` keyword:
```kotlin
class Shape
```

Properties of a class can be listed in its declaration or body.
Properties of a class can be listed in its declaration or body:

```kotlin
class Rectangle(val height: Double, val length: Double) {
val perimeter = (height + length) * 2
}
```

The default constructor with parameters listed in the class declaration is available automatically.
The default constructor with parameters listed in the class declaration is available automatically:

```kotlin
class Rectangle(val height: Double, val length: Double) {
Expand All @@ -258,7 +258,7 @@ fun main() {
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-class-constructor"}

Inheritance between classes is declared by a colon (`:`). Classes are final by default; to make a class inheritable,
mark it as `open`.
mark it as `open`:

```kotlin
open class Shape
Expand All @@ -272,7 +272,7 @@ See [classes](classes.md) and [objects and instances](object-declarations.md).

## Comments

Just like most modern languages, Kotlin supports single-line (or _end-of-line_) and multi-line (_block_) comments.
Just like most modern languages, Kotlin supports single-line (or _end-of-line_) and multi-line (_block_) comments:

```kotlin
// This is an end-of-line comment
Expand All @@ -281,7 +281,7 @@ Just like most modern languages, Kotlin supports single-line (or _end-of-line_)
on multiple lines. */
```

Block comments in Kotlin can be nested.
Block comments in Kotlin can be nested:

```kotlin
/* The comment starts here
Expand Down Expand Up @@ -330,7 +330,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-conditional-expressions"}

In Kotlin, `if` can also be used as an expression.
In Kotlin, `if` can also be used as an expression:

```kotlin
//sampleStart
Expand Down Expand Up @@ -359,7 +359,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-for-loop"}

or
or:

```kotlin
fun main() {
Expand Down Expand Up @@ -421,7 +421,7 @@ See [when expression](control-flow.md#when-expression).

## Ranges

Check if a number is within a range using `in` operator.
Check if a number is within a range using `in` operator:

```kotlin
fun main() {
Expand All @@ -436,7 +436,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-range-in"}

Check if a number is out of range.
Check if a number is out of range:

```kotlin
fun main() {
Expand All @@ -454,7 +454,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-out-of-range"}

Iterate over a range.
Iterate over a range:

```kotlin
fun main() {
Expand All @@ -467,7 +467,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-iterate-range"}

Or over a progression.
Or over a progression:

```kotlin
fun main() {
Expand All @@ -488,7 +488,7 @@ See [Ranges and progressions](ranges.md).

## Collections

Iterate over a collection.
Iterate over a collection:

```kotlin
fun main() {
Expand Down Expand Up @@ -578,7 +578,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-function-nullable-value"}

or
or:

```kotlin
fun parseInt(str: String): Int? {
Expand Down Expand Up @@ -644,7 +644,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-is-operator"}

or
or:

```kotlin
//sampleStart
Expand All @@ -667,7 +667,7 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-is-operator-expression"}

or even
or even:

```kotlin
//sampleStart
Expand Down

0 comments on commit 627adee

Please sign in to comment.