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
{{ message }}
Repository navigation
Commit 8ba1d66
Browse filesBrowse the repository at this point in the historyBrowse files
Web 0.14.22: Text-Fallnamen in Anführungszeichen (#251)
* Lektion 10: Fallnamen für Texte in Anführungszeichen ("rot", "+")
Ampel- und Rechner-Diagramme (de/en/pt) nutzen jetzt "rot"/"gelb"/"grün"
bzw. "+"/"-"/"*" als Fallnamen; Texte und Wissenstest angepasst.
Erzeugter Java-Code ist damit gültig (case "rot" statt case rot).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugz28VVaHVrA1RLEesxdrh
* Web 0.14.22: Text-Fallnamen in Anführungszeichen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugz28VVaHVrA1RLEesxdrh
---------
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ The format is loosely inspired by Keep a Changelog.
8
8
9
9
### Changed
10
10
11
+
-**Web 0.14.22, text case names in quotation marks:** in lesson 10 the traffic light structure chart now uses the case names `"rot"`, `"gelb"`, `"grün"` (en `"red"` …, pt `"vermelho"` …) and the calculator solution `"+"`, `"-"`, `"*"`, so it is clear they are texts and the generated Java (`case "rot" ->`) is valid. Lesson text, hint and quiz say so (de/en/pt). The simulation still accepts case names without quotes.
11
12
-**Web 0.14.21, array output like in Java:**`System.out.println(zahlen)` now prints a reference such as `[I@1e3779b1` in Simulation and Programmieren, as real Java does (`[D@`, `[Z@`, `[Ljava.lang.String;@`, `[[I@`; the same array keeps its id). `Arrays.toString(…)` and `Arrays.deepToString(…)` show the content; `Arrays` needs `import java.util.Arrays;` like javac, and the Java export adds it. The variable table still shows the content. Lesson 15 „Jetzt in Java“ explains reference and `Arrays.toString` (de/en/pt).
12
13
- **Web 0.14.18, upper and lower case, exercises „Warum läuft das nicht?“:** lesson 4 gets the new step „Groß- und Kleinschreibung“ (case-sensitive: `zahl`, `Zahl` and `ZAHL` are three names) with a structure chart exercise (`zahl` and `Zahl` both declared, `ZAHL` used), a Kompetenz item and a quiz question; glossary entry case-sensitive. Lessons 4–17 and 19 each get a Java exercise „Warum läuft das nicht?“: the start code doesn't run (misspelled variable such as `Alter`/`Grenze`/`properson`, variable used before it is created or never created, `system.out`, `.Length`, `charat`), the student reads the error message, fixes it and clicks Check (de/en/pt). The Code area now reports wrong case in Java words (`system.out.println`, `System.Out`, `Println`, `math.sqrt`, `text.Length()`, `name.charat(0)`) with the right spelling, blocks Run like javac and offers the 💡 fix; the simulation says „Unbekannte Variable: Zahl. Java unterscheidet Groß- und Kleinschreibung: Meintest du zahl?“ when the name exists in another case (all 21 languages).
13
14
-**Web 0.14.17, hint on a missing line break:** when a Java exercise's output is right except that lines run together (e.g. `System.out.print` twice instead of `println`), the check now says „Fast! Es fehlt nur ein Zeilenumbruch …“ and explains print vs. println, instead of only showing a mismatch. `\n` inside an output now starts a new line, so `System.out.print("…\n")` counts like `println` (de/en/pt; all exercises).
Copy file name to clipboardExpand all lines: web/lessons/de/10-fallauswahl.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,13 +39,13 @@ Derselbe Automat als Fallauswahl. Hat wahl den Wert 2, wird nur die Spalte 2 aus
39
39
40
40
## Fälle mit Texten
41
41
42
-
Die Fälle müssen keine Zahlen sein. Du kannst auch nach dem Inhalt einer `String`-Variablen auswählen. Als Fallname schreibst du dann den Text, zum Beispiel `rot`.
42
+
Die Fälle müssen keine Zahlen sein. Du kannst auch nach dem Inhalt einer `String`-Variablen auswählen. Als Fallname schreibst du dann den Text in Anführungszeichen, zum Beispiel `"rot"`. So erkennt man wie im Code, dass es ein Text ist.
43
43
44
44
::: diagramm l09-ampel.visustruct
45
45
Eine Ampel: Je nach eingegebener Farbe erscheint ein anderer Hinweis. Probiere in der Simulation auch eine Farbe aus, die es nicht gibt.
46
46
:::
47
47
48
-
Groß- und Kleinschreibung zählt: `Rot` passt nicht zum Fall `rot`.
48
+
Groß- und Kleinschreibung zählt: `Rot` passt nicht zum Fall `"rot"`.
49
49
50
50
## Übung: Note in Worten
51
51
@@ -75,7 +75,7 @@ test: 6, *, 7 -> 42
75
75
test: 1, x, 2 -> Unbekanntes Rechenzeichen
76
76
braucht: fallauswahl
77
77
tipp: Lies erst alle drei Werte ein. Danach entscheidet eine Fallauswahl über das Rechenzeichen, was gerechnet wird.
78
-
tipp: Lege vor der Fallauswahl `int ergebnis = 0` an. In jedem Fall rechnest du zum Beispiel `ergebnis = a + b` und gibst danach `ergebnis` aus. Die Fallnamen sind einfach `+`, `-` und `*`.
78
+
tipp: Lege vor der Fallauswahl `int ergebnis = 0` an. In jedem Fall rechnest du zum Beispiel `ergebnis = a + b` und gibst danach `ergebnis` aus. Die Fallnamen sind `"+"`, `"-"` und `"*"` in Anführungszeichen, weil das Rechenzeichen ein `String` ist.
79
79
lösung: l09-rechner-loesung.visustruct
80
80
:::
81
81
@@ -307,9 +307,9 @@ Schätze dich bei jedem Punkt ehrlich ein: ☂️ noch nicht, ⛅ teilweise, ☀
307
307
-[ ] Eine Farbe wie rot, gelb oder grün auswerten
308
308
> „Über 30“ ist ein Bereich. Dafür brauchst du eine Verzweigung mit einem Vergleich.
309
309
310
-
? Du gibst bei der Ampel `Rot` ein, der Fall heißt `rot`. Was passiert?
310
+
? Du gibst bei der Ampel `Rot` ein, der Fall heißt `"rot"`. Was passiert?
311
311
→ So ist die Fallauswahl aufgebaut
312
-
-[ ] Der Fall rot wird ausgeführt.
312
+
-[ ] Der Fall `"rot"` wird ausgeführt.
313
313
-[x] Der Fall default wird ausgeführt.
314
314
-[ ] Die Simulation meldet einen Fehler.
315
315
> Groß- und Kleinschreibung zählt. Rot und rot sind verschiedene Texte.
Copy file name to clipboardExpand all lines: web/lessons/en/10-fallauswahl.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,13 +39,13 @@ The same machine as a switch. If choice has the value 2, only column 2 runs.
39
39
40
40
## Cases with text
41
41
42
-
The cases do not have to be numbers. You can also choose by the content of a `String` variable. Then you write the text as the case name, for example `red`.
42
+
The cases do not have to be numbers. You can also choose by the content of a `String` variable. Then you write the text in quotation marks as the case name, for example `"red"`. Just like in code, this shows that it is a text.
43
43
44
44
::: diagramm l09-ampel.visustruct
45
45
A traffic light: depending on the colour typed in, a different message appears. In the simulation, also try a colour that does not exist.
46
46
:::
47
47
48
-
Upper and lower case matter: `Red` does not match the case `red`.
48
+
Upper and lower case matter: `Red` does not match the case `"red"`.
49
49
50
50
## Exercise: Grade in words
51
51
@@ -75,7 +75,7 @@ test: 6, *, 7 -> 42
75
75
test: 1, x, 2 -> Unknown operator
76
76
braucht: fallauswahl
77
77
tipp: First read in all three values. After that, a switch on the operator decides what is calculated.
78
-
tipp: Before the switch, create `int result = 0`. In each case you calculate, for example, `result = a + b` and then output `result`. The case names are simply `+`, `-` and `*`.
78
+
tipp: Before the switch, create `int result = 0`. In each case you calculate, for example, `result = a + b` and then output `result`. The case names are `"+"`, `"-"` and `"*"` in quotation marks, because the operator is a `String`.
79
79
lösung: l09-rechner-loesung.visustruct
80
80
:::
81
81
@@ -307,9 +307,9 @@ Rate yourself honestly for each point: ☂️ not yet, ⛅ partly, ☀️ I can
307
307
-[ ] Handling a colour such as red, yellow or green
308
308
> “Above 30” is a range. For that you need a branch with a comparison.
309
309
310
-
? At the traffic light you type `Red`, and the case is called `red`. What happens?
310
+
? At the traffic light you type `Red`, and the case is called `"red"`. What happens?
311
311
→ How a switch is built
312
-
-[ ] The case red runs.
312
+
-[ ] The case `"red"` runs.
313
313
-[x] The case default runs.
314
314
-[ ] The simulation reports an error.
315
315
> Upper and lower case matter. Red and red are different texts.
Copy file name to clipboardExpand all lines: web/lessons/pt/10-fallauswahl.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,13 +39,13 @@ A mesma máquina como seleção. Se escolha tiver o valor 2, só é executada a
39
39
40
40
## Casos com texto
41
41
42
-
Os casos não têm de ser números. Também podes escolher pelo conteúdo de uma variável `String`. Então escreves o texto como nome do caso, por exemplo `vermelho`.
42
+
Os casos não têm de ser números. Também podes escolher pelo conteúdo de uma variável `String`. Então escreves o texto entre aspas como nome do caso, por exemplo `"vermelho"`. Tal como no código, isto mostra que é um texto.
43
43
44
44
::: diagramm l09-ampel.visustruct
45
45
Um semáforo: consoante a cor introduzida, aparece uma mensagem diferente. Na simulação, experimenta também uma cor que não existe.
46
46
:::
47
47
48
-
Maiúsculas e minúsculas contam: `Vermelho` não corresponde ao caso `vermelho`.
48
+
Maiúsculas e minúsculas contam: `Vermelho` não corresponde ao caso `"vermelho"`.
49
49
50
50
## Exercício: Nota por extenso
51
51
@@ -75,7 +75,7 @@ test: 6, *, 7 -> 42
75
75
test: 1, x, 2 -> Operador desconhecido
76
76
braucht: fallauswahl
77
77
tipp: Primeiro lê os três valores. Depois, uma seleção sobre o operador decide o que é calculado.
78
-
tipp: Antes da seleção, cria `int resultado = 0`. Em cada caso calculas, por exemplo, `resultado = a + b` e depois mostras `resultado`. Os nomes dos casos são simplesmente `+`, `-` e `*`.
78
+
tipp: Antes da seleção, cria `int resultado = 0`. Em cada caso calculas, por exemplo, `resultado = a + b` e depois mostras `resultado`. Os nomes dos casos são `"+"`, `"-"` e `"*"` entre aspas, porque o operador é uma `String`.
79
79
lösung: l09-rechner-loesung.visustruct
80
80
:::
81
81
@@ -307,9 +307,9 @@ Avalia-te com honestidade em cada ponto: ☂️ ainda não, ⛅ em parte, ☀️
307
307
-[ ] Tratar uma cor como vermelho, amarelo ou verde
308
308
> “Acima dos 30” é um intervalo. Para isso precisas de uma decisão com uma comparação.
309
309
310
-
? No semáforo escreves `Vermelho`, e o caso chama-se `vermelho`. O que acontece?
310
+
? No semáforo escreves `Vermelho`, e o caso chama-se `"vermelho"`. O que acontece?
311
311
→ Como se constrói uma seleção
312
-
-[ ] É executado o caso vermelho.
312
+
-[ ] É executado o caso `"vermelho"`.
313
313
-[x] É executado o caso default.
314
314
-[ ] A simulação indica um erro.
315
315
> Maiúsculas e minúsculas contam. Vermelho e vermelho são textos diferentes.
0 commit comments