if (logical expression) executable statementÀÌ´Â ÇÑ ÁÙ¿¡ Àû¾î¾ß ÇÑ´Ù. À§ ¿¹¿¡¼´Â xÀÇ Àý´ë°ªÀ» ±¸ÇÏ´Â °ÍÀÌ´Ù.
if (x .LT. 0) x = -xif ³»ºÎ¿¡¼ ÇÑ ¹®Àå ÀÌ»óÀ» ¼öÇàÇÏ¿©¾ß ÇÒ °æ¿ì¿¡´Â ´ÙÀ½ÀÇ syntax¸¦ »ç¿ëÇÑ´Ù.
if (logical expression) then statements endif°¡Àå ÀϹÝÀûÀÎ if¹®ÀÇ ÇüÅ´Â
if (logical expression) then statements elseif (logical expression) then statements : : else statements endif¼öÇà ¼ø¼´Â À§¿¡¼ ¾Æ·¡ ¹æÇâÀÌ´Ù. Á¶°Ç½ÄÀº Çϳª°¡ ÂüÀ϶§ ±îÁö ¼ø¼´ë·Î ±× °ªÀ» ±¸ÇÑ´Ù. ±× ÈÄ ±×¿Í °ü·ÃµÈ code¸¦ ¼öÇàÇÏ°í endif ÀÌÈÄÀÇ ´ÙÀ½ ¹®ÀåÀ¸·Î ¶Ù¾î ³Ñ´Â´Ù.
if (x .GT. 0) then if (x .GE. y) then write(*,*) 'x is positive and x >= y' else write(*,*) 'x is positive but x < y' endif elseif (x .LT. 0) then write(*,*) 'x is negative' else write(*,*) 'x is zero' endif³Ê¹« ¿©·¯ ´Ü°èÀÇ if ¹®À» °ãÃÄ ¾²¸é µû¶óÀâ±â Èûµé¹Ç·Î ÁÖÀÇÇÏ¿©¾ß ÇÑ´Ù.
x+y if x and y are both positive x-y if x is positive and y negative y if x is negative 0 if x or y is zero