萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> asp編程 >> asp byref 讓函數同時返回多值幾種做法

asp byref 讓函數同時返回多值幾種做法

          我們就以asp教程來舉例說明關於,如何在用戶自定義函數調用時反回多的值,先來看一組代碼

         <% 
         call getmynumber(aa,bb,cc) 
         response.write aa & " " & bb & "<br />" & cc 
         function getmynumber(byref aa,byref bb,byref cc) 
         aa=3 
         bb=4 
         cc =10 
         end function 
         %> 這裡是利用了byref再看詳細的

         sub test(byref a as integer, byval b as integer)
             a = 3
             b = 4
         end sub
         sub main()
             dim a as integer
             dim b as integer
             a = 1
             b = 2
             test a, b
             msgbox "a=" & a & ";b=" & b
         end sub
         輸出結果 a=3;b=2byref作用是存址參數,通過操作參數的內存地址實現全局控制,

copyright © 萬盛學電腦網 all rights reserved