Advertisement
uebellehrer

IF2

May 20th, 2021
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Console
  2.  
  3. Module Program
  4.     'Vereinbarungsteil
  5.    Dim Antwort As String
  6.     Sub Main()
  7.         'Eingabe
  8.        Write("Hallo, alles klar? Antworte mit Ja/Nein: ")
  9.         Antwort = ReadLine()
  10.  
  11.         'Zweiseitige Ausgabe
  12.        If Antwort = "Nein" Then
  13.             WriteLine("Oh weh!")
  14.         Else
  15.             WriteLine("Let's go!")
  16.         End If
  17.  
  18.         'Einseitige Ausgabe
  19.        If Antwort = "Ja" Then
  20.             WriteLine("Super!")
  21.         End If
  22.         If Antwort = "Nein" Then
  23.             WriteLine("Schade...")
  24.         End If
  25.         ' Zusatz Lösung: Der Else-Block der zweiseitigen Auswahl Zeile 14 wird immer ausgeführt sobald der Benutzer etwas anderes als "Nein" eingibt.
  26.        ' Im Gegensatz dazu funktioniert die einseitige Auswahl nur wenn man Ja oder Nein eingibt!
  27.  
  28.     End Sub
  29. End Module
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement