Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
36
Task/Optional-parameters/Fortran/optional-parameters-2.f
Normal file
36
Task/Optional-parameters/Fortran/optional-parameters-2.f
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
program UsingTest
|
||||
use ExampleOptionalParameter
|
||||
implicit none
|
||||
|
||||
type(table_type) :: table
|
||||
|
||||
! create the table...
|
||||
|
||||
! sorting taking from column 1, not reversed, using internal
|
||||
! default comparator
|
||||
call sort_table(table)
|
||||
|
||||
! the same as above, but in reversed order; we MUST specify
|
||||
! the name of the argument since it is not given in the same
|
||||
! order of the subroutine spec
|
||||
call sort_table(table, reverse=.true.)
|
||||
|
||||
! sort the table using a custom comparator
|
||||
call sort_table(table, my_cmp)
|
||||
! or
|
||||
call sort_table(table, ordering=my_cmp)
|
||||
|
||||
! as above, but taking from column 2
|
||||
call sort_table(table, my_cmp, 2)
|
||||
! or (swapping the order of args for fun)
|
||||
call sort_table(table, column=2, ordering=my_cmp)
|
||||
|
||||
! with custom comparator, column 2 and reversing...
|
||||
call sort_table(table, my_cmp, 2, .true.)
|
||||
! of course we can swap the order of optional args
|
||||
! by prefixing them with the name of the arg
|
||||
|
||||
! sort from column 2, with internal comparator
|
||||
call sort_table(table, column=2)
|
||||
|
||||
end program UsingTest
|
||||
Loading…
Add table
Add a link
Reference in a new issue