Advertisement
alphauser420

switch

Mar 12th, 2024
2
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Local $day = "Thursday"
  2.  
  3. Switch $day
  4. Case "Monday"
  5. MsgBox(0, "Day", "It's Monday.")
  6. Case "Tuesday"
  7. MsgBox(0, "Day", "It's Tuesday.")
  8. Case "Wednesday"
  9. MsgBox(0, "Day", "It's Wednesday.")
  10. Case "Thursday"
  11. MsgBox(0, "Day", "It's Thursday.")
  12. Case "Friday"
  13. MsgBox(0, "Day", "It's Friday.")
  14. Case Else
  15. MsgBox(0, "Day", "It's a weekend day.")
  16. EndSwitch
  17.  
  18. ; Explanation:
  19. 0: Specifies the type of the message box. In this case, it is set to 0, which means it's a standard message box with an "OK" button
  20. ; The Switch statement is used to evaluate the value of $day and execute the corresponding Case.
  21. ; If $day matches any of the specified cases, the corresponding MsgBox is displayed.
  22. ; If $day doesn't match any of the cases, the code inside Case Else is executed.
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement