test_if Subroutine

subroutine test_if()

Arguments

None

Contents

Source Code


Source Code

subroutine test_if ()
   call lala( [ character(len=256) :: &
     & 'display(ones(80,1)''*61)                                                  ', &
     & 'help if                                                                  ', &
     & 'display(ones(80,1)''*95)                                                  ', &
     & 'tally=[0];                                                               ', &
     & '                                                                         ', &
     & ' n=5;                                                                    ', &
     & '                                                                         ', &
     & ' for i = 1:n, for j = 1:n, ...                                           ', &
     & '    if i = j, a(i,j) = 2; else if abs(i-j) = 1, a(i,j) = -1; ...         ', &
     & '    else a(i,j) = 0;                                                     ', &
     & '                                                                         ', &
     & ' // An easier way to accomplish the same thing is                        ', &
     & ' b = 2*eye(n);                                                           ', &
     & ' for i = 1:n-1, b(i,i+1) = -1; b(i+1,i) = -1;                            ', &
     & '                                                                         ', &
     & 'if a=b, tally=[tally,0];display(''matches'');else,tally=[tally,1];display(''does not match'');', &
     & 'if sum(tally)=0,display(''if PASSED'');else,display(''if FAILED'');tally ', &
     & ''])
end subroutine test_if