Skip to content

Commit 2ddc3c7

Browse files
authored
Merge pull request #1163 from dockfries/master
fix HTML minifier diagnostic error `hello world` in Greek
2 parents ded40a7 + 7991004 commit 2ddc3c7

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

frontend/docs/scripting/language/reference/12-Assorted-tips.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Listing: “hello world” in Greek
138138
```c
139139

140140
main()
141-
printf "‚„ƒ†…˙ ‡‰ˆ‹ŠŒŽ ˙Љˆ‰‹Š„‘\n"
141+
printf "Γειάσου κόσμος\n"
142142

143143
```
144144

frontend/i18n/fa/docusaurus-plugin-content-docs/current/scripting/language/reference/12-Assorted-tips.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ strupper(string[])
137137
```c
138138

139139
main()
140-
printf "˙ ˙\n"
140+
printf "Γειάσου κόσμος\n"
141141

142142
```
143143

frontend/i18n/pt-BR/docusaurus-plugin-content-docs/current/scripting/language/reference/04-Functions.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ expression, the function will get executed in that statement/expression.
173173
The statement that refers to the function is the “caller” and the function itself,
174174
at that point, is the “callee”: the one being called.
175175
176-
The standard syntax for calling a function is to write the
176+
The standard syntax for calling a function is to write the
177+
177178
### • Chamando funções
178179
179180
Para chamar uma função, escreva o nome seguido da lista de parâmetros entre parênteses. Mesmo que não haja argumentos, os parênteses permanecem. O exemplo below mostra como chamar `power`:
@@ -620,8 +621,9 @@ Programas standalone precisam ter `main` (sem parâmetros), ponto de partida da
620621
621622
Bibliotecas não exigem `main`, mas devem possuir pelo menos uma função pública. `main` é o entry point primário; funções `public` fornecem pontos alternativos. A VM pode iniciar por uma função pública e, em bibliotecas, `main` pode servir para inicializações.
622623
623-
Para declarar uma função pública, prefixe o nome com `public`. Exemplo: um editor de texto poderia chamar `onkey` a cada tecla digitada para que o script modifique/rejeite caracteres.
624-
Latin-1 character set) by the “hard space” code in the ANSI character table:
624+
Para declarar uma função pública, prefixe o nome com `public`. Exemplo: um editor de texto poderia chamar `onkey` a cada tecla digitada para que o script modifique/rejeite caracteres. A função
625+
onkey abaixo substituiria cada caractere “~” (código 126 no conjunto
626+
de caracteres ISO Latin‑1) pelo código de “espaço duro” na tabela ANSI:
625627
626628
Listing: onkey function
627629
@@ -1082,9 +1084,13 @@ parser will attempt to use the user-defined operator rather than the default
10821084
`User-defined operators: 86`
10831085

10841086
---
1087+
10851088
### • Call by Value and Call by Reference
1089+
10861090
In Pawn, function arguments can be passed in two ways: by value and by reference.
1091+
10871092
#### Call by value
1093+
10881094
In this method, the value of the variable is passed to the function. A copy of the variable is created and the function operates on the copy, not the original variable. Any changes made to the variable inside the function do not affect the original variable.
10891095

10901096
```c
@@ -1101,14 +1107,18 @@ main(){
11011107
printf("The value of x is %d and value of y is %d, after calling 'swap'.", x, y);
11021108
}
11031109
```
1110+
11041111
Output
1112+
11051113
```
11061114
The value of x is 10 and value of y is 20, before calling 'swap'.
11071115
The value of x is 10 and value of y is 20, after calling 'swap'.
11081116
```
11091117
11101118
#### Call by reference
1119+
11111120
In this method, the address of the variable is passed to the function. The function operates on the original variable and any changes made to the variable inside the function are reflected in the original variable.
1121+
11121122
```c
11131123
swap(&a, &b){
11141124
new c = a;
@@ -1123,19 +1133,28 @@ main(){
11231133
printf("The value of x is %d and value of y is %d, after calling 'swap'.", x, y);
11241134
}
11251135
```
1136+
11261137
Output
1138+
11271139
```
11281140
The value of x is 10 and value of y is 20, before calling 'swap'.
11291141
The value of x is 20 and value of y is 10, after calling 'swap'.
11301142
```
11311143

11321144
### • Recursion / Function Recursion
1145+
11331146
Recursion in programming refers to the process of a function calling itself in order to solve a problem. It's a fundamental concept used to solve problems that can be broken down into smaller instances of the same problem. Recursion consists of two main components: base cases and recursive cases.
1134-
##### Base Case:
1147+
1148+
##### Base Case:
1149+
11351150
Every recursive function should have one or more base cases. A base case is a condition under which the function stops calling itself and returns a result directly. Without base cases, the recursion would continue indefinitely, causing a stack overflow. Read Stack/Heap section to know more about it.
1151+
11361152
##### Recursive Case:
1153+
11371154
The recursive case is where the function calls itself to solve a smaller instance of the problem. Each recursive call should bring the problem closer to a base case.
1155+
11381156
#### Example
1157+
11391158
```c
11401159
stock factorial(n) {
11411160
// Base case: factorial of 0 is 1
@@ -1153,7 +1172,9 @@ main() {
11531172
printf("Factorial of %d is %d", num, result); // Output: Factorial of 3 is 6
11541173
}
11551174
```
1175+
11561176
#### Demonstrate the Output
1177+
11571178
```
11581179
main() \\ main function from where execution of program starts
11591180
new num = 3; \\ creates a num variable
@@ -1169,11 +1190,15 @@ factorial(3) \\ factorial initiate
11691190
else{ 1 * factorial(1-1) } \\ 3 * 2 * 1 and calls the factorial(0)
11701191
factorial(0) \\ factorial initiate again
11711192
if(0 == 0) return 1 \\ checks the conition which is true and return 1
1172-
\\ at the final call 3 * 2 * 1 * 1
1193+
\\ at the final call 3 * 2 * 1 * 1
11731194
```
1195+
11741196
### Stack Memory
1197+
11751198
The stack is a region of memory used for storing local variables, function call information, and control flow data. It operates in a Last-In-First-Out (LIFO) manner, which means that the last item pushed onto the stack is the first one to be popped off.
1199+
11761200
#### Example (Stack Overflow)
1201+
11771202
```c
11781203
#pragma dynamic 35 // (35 * 4 bytes, a cell size) #pragma dynamic [cells] helps to modify the size of stack, read docs/scripting/language/Directives to know more about #pragma
11791204
main(){
@@ -1184,14 +1209,17 @@ grow_stacK(n){ // recursive function
11841209
grow_stacK(n+1);
11851210
}
11861211
```
1212+
11871213
#### Output
1214+
11881215
```
11891216
N: 1
11901217
N: 2
11911218
N: 3
11921219
.. .
11931220
Stack/heap collision (insufficient stack size)
11941221
```
1222+
11951223
![Stack](https://i.imgur.com/ZaIVUkJ.png)
11961224

11971225
[Go Back to Contents](00-Contents)

0 commit comments

Comments
 (0)