Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wenn/sonst Operator #66

Closed
NotLe0n opened this issue May 5, 2024 · 0 comments
Closed

Wenn/sonst Operator #66

NotLe0n opened this issue May 5, 2024 · 0 comments
Assignees
Labels
Typ: Neues Feature Neues Feature

Comments

@NotLe0n
Copy link
Member

NotLe0n commented May 5, 2024

Warum

Oft schreibt man etwas wie:

Die Zahl z ist 0.
Wenn <bedingung>, dann:
    Speichere 1 in z.
Sonst:
    Speichere 2 in z.

Diese fünf (oder drei mit Verkürzungen) Zeilen für eine so einfache logik lesen sich nicht gut.

Lösung

Einen neuen Operator der genau so wie der ternary operator (a ? b : c) in anderen Programmiersprachen funktioniert.

Die Zahl ist 1 wenn <bedingung>, sonst 2.
@NotLe0n NotLe0n added the Typ: Neues Feature Neues Feature label May 5, 2024
@NotLe0n NotLe0n self-assigned this Jun 2, 2024
@NotLe0n NotLe0n closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typ: Neues Feature Neues Feature
Projects
None yet
Development

No branches or pull requests

1 participant