You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapter-03-simple-conditions.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ Like the example above, read the grade from the console and check if it is excel
107
107
Test your solution here: [https://judge.softuni.org/Contests/Practice/Index/651#1](https://judge.softuni.org/Contests/Practice/Index/651#1).
108
108
109
109
110
-
## The Curly Brackets {} After If \/ Else
110
+
## The Curly Brackets `{}` After If \/ Else
111
111
112
112
When we have **only one command** in the body of the **`if` statement**, we can **skip the curly brackets**. When we want to execute a **block of code** (group of commands), curly brackets are required, because if we skip them, **only the first line** after the **`if` clause** will be executed.
Copy file name to clipboardExpand all lines: chapter-04-complex-conditions.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -91,7 +91,7 @@ Test your solution here: [https://judge.softuni.org/Contests/Practice/Index/653#
91
91
92
92
Let's take a look at how we can create more complex logical conditions. We can use the logical "**AND**" (**`&&`**), logical "**OR**" (**`||`**), logical **negation** (**`!`**) and **brackets** (**`()`**).
93
93
94
-
### Logical "AND"
94
+
### Logical `AND`
95
95
96
96
As we saw, in some problems we have to make **many checks at once**. But what happens when to execute some code **more** conditions have to be executed and we **don't want to** make a **negation** (**`else`**) for each one of them? The option with nested **`if` blocks** are valid, but the code would look very **unordered** and for sure – **hard** to read and maintain.
Copy file name to clipboardExpand all lines: chapter-07-complex-loops.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -262,7 +262,7 @@ We can use the following idea to solve the problem:
262
262
Test your solution here: [https://judge.softuni.org/Contests/Practice/Index/659#8](https://judge.softuni.org/Contests/Practice/Index/659#8).
263
263
264
264
265
-
## Infinite Loops and break Operator
265
+
## Infinite Loops and `break` Operator
266
266
267
267
So far, we got acquainted with different types of loops and learned about their constructions and how they are applied. Now, we need to understand what an **infinite loop** is, when it occurs and how we can **terminate** its execution through the **`break`** operator.
268
268
@@ -278,7 +278,7 @@ And here is what an **infinite `for`** loop looks like:
We already know that the infinite loop executes a specific code to infinity, but what if we want to forcibly exit the loop under a given condition at some point? In this situation, the **`break`** operator comes in handy.
284
284
@@ -357,7 +357,7 @@ Note: although the code above is correct, it will not work if the user enters te
357
357
Test your solution here: [https://judge.softuni.org/Contests/Practice/Index/659#10](https://judge.softuni.org/Contests/Practice/Index/659#10).
358
358
359
359
360
-
## Nested Loops and The break Operator
360
+
## Nested Loops and The `break` Operator
361
361
362
362
Having learned what **nested loops** are and how the **`break`** operator performs, it is time to understand how they both work together. For a better understanding, let’s write a step-by-step **program** that should make all possible combinations of **pairs of numbers**. The first number of the combination is increasing from 1 to 3, and the second one is decreasing from 3 to 1. The problem must continue running until **`i + j`****is not equal** to 2 (i.e., **`i = 1`** and **`j = 1`**).
363
363
@@ -390,21 +390,21 @@ Thus, when **`i + j = 2`**, the program will set the **`hasToEnd = true`** and e
390
390
Test your solution here: [https://judge.softuni.org/Contests/Practice/Index/659#11](https://judge.softuni.org/Contests/Practice/Index/659#11).
391
391
392
392
393
-
## Error Handling: try-catch Construction
393
+
## Error Handling: `try-catch` Construction
394
394
395
395
The last thing we will get familiar with within this chapter is how to "catch" **errors** with the **`try-catch`** construction.
396
396
397
-
### What is a try-catch?
397
+
### What is a `try-catch`?
398
398
399
399
The **`try-catch`** program construction is used to **intercept and handle exceptions (errors)** during the program execution.
400
400
401
401
In programming, **exceptions** are notifications of an event that disrupts the normal operation of a program. Such exceptional events **interrupt the execution** of our program, and it is looking for something to handle the situation. If it does not find it, the exception is printed on the console (the program "fails"). If it finds, **the exception is processed** and the program continues its normal execution without "failing". In a bit, we will see how this happens.
402
402
403
403
When an exception occurs, the exception is said to have been **”thrown” (throw exception)**. Hence the expression **”catch exception”**.
404
404
405
-
### The try-catch Construction
405
+
### The `try-catch` Construction
406
406
407
-
The **`try-catch`** construction has different types, but for now, we will get acquainted only with the most basic of them, where the **`catch`** block will intercept any error in a variable named **`ex`**
407
+
The **`try-catch`** construction has different types, but for now, we will get acquainted only with the most basic of them, where the **`catch`** block will intercept any error in a variable named **`ex`**
Copy file name to clipboardExpand all lines: chapter-10-methods.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -247,7 +247,7 @@ If we **replace** **`void`** with **a type** of some variable, this will tell th
247
247
248
248
We should note that **the result** returned by the method can be of **a type, compatible with the type of the returned value** of the method. For example, if the declared type of the returned value is **`double`**, we can return a value of **`int`** type.
249
249
250
-
### The return Operator
250
+
### The `return` Operator
251
251
252
252
To obtain a result from the method, we need to use the **`return`** operator. It should be **used in the body** of the method and tells the program to **stop its execution** and to **return** to the method's caller, a **value** that is defined by the expression after the **`return`** operator.
253
253
@@ -263,7 +263,7 @@ We have a method in the example below, which compares two numbers and returns a
When the **return** operator is located inside a conditional statement such as **`if`**, after the statement in the same block, we must **not** have rows with code because IntelliJ IDEA will display a warning telling us that it had found an **unreachable** statement.
269
269
@@ -274,7 +274,7 @@ When the **return** operator is located inside a conditional statement such as *
274
274
with the phrase <b><i>write</i> <code>return; return;</code> <i>and let's go home</i></b>”, to explain that the logic of the program is wrongly typed.</td></tr>
275
275
</table>
276
276
277
-
### Using The "return" Value of a Method
277
+
### Using The `return` Value of a Method
278
278
279
279
After a method is executed and has returned a value, we can use the value in several ways.
280
280
@@ -365,7 +365,7 @@ As we mentioned, if you use **the same name for several methods with different s
It is important to say that **the returned type as a result** of the method **is not a part of its signature**. If the returned type was a part of the signature, then the compiler doesn't know which method exactly to call (there is ambiguity).
0 commit comments