How to use this tool?

This free online converter lets you convert code from Fortran to Swift in a click of a button. To use this converter, take the following steps -

  1. Type or paste your Fortran code in the input box.
  2. Click the convert button.
  3. The resulting Swift code from the conversion will be displayed in the output box.

Examples

The following are examples of code conversion from Fortran to Swift using this converter. Note that you may not always get the same code since it is generated by an AI language model which is not 100% deterministic and gets updated from time to time.

Example 1 - Is String Palindrome

Program that checks if a string is a palindrome or not.

Fortran

right arrow

Swift

Example 2 - Even or Odd

A well commented function to check if a number if odd or even.

Fortran

right arrow

Swift

Key differences between Fortran and Swift

CharacteristicFortranSwift
SyntaxFortran has a fixed-format syntax with strict column-based rules.Swift has a modern, expressive, and concise syntax.
ParadigmFortran is primarily a procedural programming language.Swift is a multi-paradigm language that supports both procedural and object-oriented programming.
TypingFortran has static typing.Swift has strong static typing with type inference.
PerformanceFortran is known for its high performance in scientific and numerical computing.Swift is a high-performance language, but it may not be as optimized for scientific computing as Fortran.
Libraries and frameworksFortran has a wide range of libraries and frameworks for scientific and numerical computing.Swift has a growing ecosystem of libraries and frameworks, but it may not have as many options for scientific computing as Fortran.
Community and supportFortran has a dedicated community and good support for scientific computing.Swift has a large and active community with good support from Apple and the open-source community.
Learning curveFortran has a steeper learning curve, especially for beginners.Swift has a relatively gentle learning curve, especially for those familiar with modern programming languages.