옥타브(http://octave.org)라는 프로그램을 써서 코드를 만들다보면 변수이름이 길어지고, 여러 변수를 넣고 연산하는 식을 쓰다보면 식이 한 줄에 안 써지는 경우가 있다.[각주:1] 그래서 다음 줄로 넘겨서 계속 이어서 쓰고 싶은 경우가 있는데, 이게 옥타브라는 물건은 행을 바꾸면 명령이 끝나는 것으로 인식하는 몇 안 되는 프로그램이다. [각주:2] 그게 평소에는 엔터만 치면 다음 줄로 넘어가고 새로운 명령이 시작되니 편한데, 식이 길어질 때는 문제가 된다. 그래서 찾아보니 이런 글이 있더라.[각주:3]

Command Line Continuation

You can continue most statements to one or more additional lines by terminating each incomplete line with an ellipsis(...). Breaking down a statement into a number of lines can sometimes result in a clearer programming style.

sprintf ('Example %d shows a command coded on %d lines.\n', ...
          exampleNumber, ...
          numberOfLines)

Note that you cannot continue an incomplete string to another line.

disp 'This statement attempts to continue a string ...
      to another line, resulting in an error.'

한 마디로 점 세개 ... 찍어주면 다음 줄로 이어진다는 뜻.
잊어버리기 싫어서 적어둔다. :)

  1. my_calculation_result = ( my_first_variable + my_second_variable ) * my_coefficient / my_denominator 처럼 말이지. [본문으로]
  2. C나 Maple 경우 세미콜론(;)을 써야 끝나고, LaTeX의 경우 엔터는 그냥 띄어쓰기로 인식한다. [본문으로]
  3. http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f10-60037.html [본문으로]
저작자 표시 비영리 변경 금지
Posted by 꾸로gguro

트랙백 주소 :: http://gguro.com/trackback/175 관련글 쓰기

댓글을 달아 주세요

  1. Ens 2010/01/14 05:12  댓글주소  수정/삭제  댓글쓰기

    MatLab 도 마찬가지지..
    가끔 긴 Matrix 를 넣어야 할 경우에..
    이렇게 세점을 찍는 것이 아주 필요하게 되는 거지..

  2. 병철 2010/01/20 15:44  댓글주소  수정/삭제  댓글쓰기

    몇 안되는... 이라고 하기엔 저런 물건들이 꽤 많다.

    인터프리터 형식을 취하는 프로그래밍 랭귀지 툴들은 그런 경우가 많고
    (Prolog나 LISP 등등)

    C의 매크로 선언 (#define ... 으로 하는) 도 개행을 하면 반드시 연결 부호 (#) 을
    넣어주어야 한다네.