Swift Basic Programs

This section contains the basic programs of Swift programming language like printing text, reading values, programs based on the basic operators, conditional-bases programs, etc.

Practice these Swift basic programs to learn the basic programming concepts of Swift, these programs contain the solved code, outputs, and the detailed explanation of the statements, functions used in the Swift basic programs.

List of Swift Basic Programs

  1. Swift program to print 'Hello World'
  2. Swift program to create different types of variables
  3. Swift program to create variables with specifying data type
  4. Swift program to demonstrate the escape sequences
  5. Swift program to demonstrate the '\()' to embed the value of the variable within the string
  6. Swift program to create a constant
  7. Swift program to create a constant with binary value and print it in decimal number
  8. Swift program to create a constant with hexadecimal value and print it in decimal number
  9. Swift program to create an alias of basic types
  10. Swift program to print the line number of source code using the #line directive
  11. Swift program to print the size of variables
  12. Swift program to read an integer number from the user
  13. Swift program to read a float number from the user
  14. Swift program to demonstrate the Int() function with Invalid value
  15. Swift program to print the character corresponding ASCII value
  16. Swift program to demonstrate the arithmetic operators
  17. Swift program to demonstrate the assignment operators
  18. Swift program to assign multiple variables in a single statement
  19. Swift program to demonstrate the unary minus '-' and unary plus '+' operators
  20. Swift program to demonstrate the comparison operators
  21. Swift program to demonstrate the logical AND (&&) operator
  22. Swift program to demonstrate the logical OR (||) operator
  23. Swift program to demonstrate the logical NOT (!) operator
  24. Swift program to demonstrate the closed range operator
  25. Swift program to demonstrate the Half-Open range operator
  26. Swift program to demonstrate the one-sided range operator
  27. Swift program to perform the bitwise left-shift operation
  28. Swift program to perform the bitwise right-shift operation
  29. Swift program to perform the bitwise AND operation
  30. Swift program to perform the bitwise OR operation
  31. Swift program to perform the bitwise XOR operation
  32. Swift program to perform the bitwise NOT operation
  33. Swift program to swap two numbers using the bitwise XOR operator
  34. Swift program to print the minimum and maximum value of data type Int8
  35. Swift program to print the minimum and maximum value of data type UInt8
  36. Swift program to print the minimum and maximum value of data type Int



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.