FORTRAN (فورترن)

FORTRAN که از ترکیب ۲ کلمهٔ FORmula (فرمول) و TRANslation (ترجمه) تشکیل شده، نام یک زبان برنامه‌نویسی نسل سوم است که در دههٔ ۱۹۵۰ در شرکت IBM و اساساً به منظور استفادهٔ مهندسان، ریاضی‌دانان و سایر کاربرانی که عمدتاً با فرمول‌ها و محاسبات سر و کار داشته و یا نیاز به ایجاد الگوریتم‌های علمی جدید داشتند طراحی و ایجاد شد. به عنوان یک نمونه سورس‌کد فورترن داریم:

module class_Circle
  implicit none
  private
  real :: pi = 3.1415926535897931d0 ! Class-wide private constant

  type, public :: Circle
     real :: radius
   contains
     procedure :: area => circle_area
     procedure :: print => circle_print
  end type Circle
contains
  function circle_area(this) result(area)
    class(Circle), intent(in) :: this
    real :: area
    area = pi * this%radius**2
  end function circle_area

  subroutine circle_print(this)
    class(Circle), intent(in) :: this
    real :: area
    area = this%area()  ! Call the type-bound function
    print *, 'Circle: r = ', this%radius, ' area = ', area
  end subroutine circle_print
end module class_Circle


program circle_test
  use class_Circle
  implicit none

  type(Circle) :: c     ! Declare a variable of type Circle.
  c = Circle(1.5)       ! Use the implicit constructor, radius = 1.5.
  call c%print          ! Call the type-bound subroutine
end program circle_test

این زبان سینتکس بسیار خلاصه و ساده‌ای دارد؛ سادگی و در عین حال توانایی محاسباتی بالا در زبان FORTRAN سبب شد تا به زبان محبوب مهندسان و دانشمندان علوم مختلف تبدیل گردد. لازم به ذکر است که امروزه زبان برنامه‌نویسی C چنین نیا‌زهایی را برطرف نموده و تا حد زیادی جایگزین زبان FORTRAN شده است.

online-support-icon