some small improvements in English

This commit is contained in:
2026-02-22 19:18:21 +01:00
parent 3b9c141c44
commit 552438aebe
8 changed files with 83 additions and 99 deletions

View File

@@ -16,21 +16,21 @@ using InteractiveUtils
- Names may contain letters, digits, underscores `_`, and exclamation marks `!`.
- The first character must be a letter or an underscore.
- Case is significant: `Nmax` and `NMAX` are different variables.
- The character set used is [Unicode](https://home.unicode.org/). This provides access to over 150 scripts and numerous symbols.
- The character set used is [Unicode](https://home.unicode.org/), which provides access to over 150 scripts and numerous symbols.
- There is a short [list of reserved keywords](https://docs.julialang.org/en/v1/base/base/#Keywords): `if, then, function, true, false,...`
:::{.callout-tip}
## Example
permissible: `i, x, Ω, x2, DieUnbekannteZahl, neuer_Wert, 🎷, Zähler, лічильник, einself!!!!,...`
Permissible: `i, x, Ω, x2, DieUnbekannteZahl, neuer_Wert, 🎷, Zähler, лічильник, einself!!!!,...`
impermissible: `Uwe's_Funktion, 3achsen, A#B, $this_is_not_Perl, true,...`
Impermissible: `Uwe's_Funktion, 3achsen, A#B, $this_is_not_Perl, true,...`
:::
----
:::{.callout-note }
## Note
## Note:
In addition to the *reserved keywords* of the core language, numerous additional functions and objects are predefined, such as the mathematical functions `sqrt(), log(), sin()`.
These definitions are found in the module `Base`, which Julia loads automatically at startup.
@@ -41,7 +41,7 @@ Names from `Base` can be redefined as long as they have not yet been used:
log = 3
1 + log
```
Now of course the logarithm is broken:
Now, of course, the logarithm is broken:
```{julia}
#| error: true
x = log(10)
@@ -62,13 +62,14 @@ x = log(10)
:::{.callout-tip}
## Example
## Example:
In interactive mode, the value of the last statement is also displayed without explicit `print()`:
```{julia}
println("Hallo 🌍!")
x = sum([i^2 for i=1:10])
```
The semicolon suppresses this:
```{julia}
println("Hallo 🌍!")
@@ -81,14 +82,14 @@ x = sum([i^2 for i=1:10]);
:::{.callout-warning }
For multi-line statements, the line to be continued must end with an open operation or parenthesis:
For multi-line statements, the line to be continued must end with an open operator or parenthesis.
```{julia}
x = sin(π/2) +
3 * cos(0)
```
Therefore, the following goes wrong, but unfortunately **without an error message**!
Therefore, the following goes wrong, butunfortunately**without an error message**!
```{julia}
#| error: true
#| warning: true
@@ -98,7 +99,7 @@ println(x)
```
Here, the `+` in the second line is interpreted as a prefix operator (sign). Thus, lines 1 and 2 are each complete, correct expressions on their own (even though line 2 is of course completely useless) and are processed as such.
Moral: If you want to split longer expressions across multiple lines, you should always open a parenthesis. Then it doesn't matter where the line break occurs:
**Moral:** If you want to split longer expressions across multiple lines, you should always open a parenthesis. Then it doesn't matter where the line break occurs.
```{julia}
x = ( sin(π/2)
+ 3 * cos(0) )
@@ -119,12 +120,10 @@ x = 2 # everything from '#' to the end of the line is a comment and is ignore
```{julia}
#=
Single and multi-line comments can be enclosed between #= ... =#.
Nested comments are possible.
#=
i.e., unlike in C/C++/Java, the comment does not end with the first
comment-end character, but the #=...=# pairs act like parentheses.
=#
Single and multi-line comments can be enclosed between `#= ... =#`. Nested comments are possible.
`#=`
i.e., unlike in C/C++/Java, the comment does not end with the first comment-end character, but the `#=...=#` pairs act like parentheses.
`=#`
The automatic 'syntax highlighter' does not yet know this, as the alternating
gray shading of this comment shows.
=#
@@ -136,10 +135,10 @@ x #= das ist ein seltener Variablenname! =# = 3
## Data Types Part I
- Julia is a [strongly typed](https://de.wikipedia.org/wiki/Starke_Typisierung) language. All objects have a type. Functions/operations expect arguments of the correct type.
- Julia is a [strongly typed](https://de.wikipedia.org/wiki/Starke_Typisierung) language. All objects have a type. Functions and operations expect arguments of the correct type.
- Julia is a [dynamically typed](https://de.wikipedia.org/wiki/Dynamische_Typisierung) language. Variables have no type. They are names that can be bound to objects via assignment `x = ...`.
- When speaking of the "type of a variable", one means the type of the object currently assigned to the variable.
- Functions/operators can implement different *methods* for different argument types.
- Functions and operators can implement different *methods* for different argument types.
- Depending on the concrete argument types, it is decided at function usage which method is used ([*dynamic dispatch*](https://en.wikipedia.org/wiki/Dynamic_dispatch)).
@@ -184,8 +183,8 @@ x, typeof(x), sizeof(x)
### `if` Blocks
- An `if` block *can* contain **any number** of `elseif` branches and at the end at most **one** `else` branch.
- The block has a value, the value of the last executed statement.
- An `if` block can contain any number of `elseif` branches and, at the end, at most one `else` branch.
- The block has a value: the value of the last executed statement.
```{julia}
x = 33
@@ -205,7 +204,7 @@ end # value of the entire block is the value
# last evaluated statement
```
Short blocks can be written in one line:
Short blocks can be written on one line:
```{julia}
if x > 10 println("x is larger than 10") end
```
@@ -248,7 +247,7 @@ z = if x < y
- `<`
- `<=`, `≤`
As usual, the equality test `==` is to be distinguished from the assignment operator `=`. Almost anything can be compared:
As usual, the equality test `==` must be distinguished from the assignment operator `=`. Almost anything can be compared.
```{julia}
"Aachen" < "Leipzig", 10 ≤ 10.01, [3,4,5] < [3,6,2]