Sunday, July 26, 2009

"scan" statement in VB and FoxPro? and "case" statement in Turbo C? is there such thing?

a sample code? website where I can find a program code for VB and FoxPro with "scan" or equivalent syntax/statement? same to the "case" syntax/statement for Turbo C???





Thanks 4 any help!

"scan" statement in VB and FoxPro? and "case" statement in Turbo C? is there such thing?
VB: there is no Scan-Endscan.


VFP: Scan-Endscan perform looping (like a do while-enddo) in relation reading each record of a table based on the condition specified on the Scan command. This is different from the switch-case of Turbo-C.


e.g. (from VFP MSDN help)


USE customer %26amp;%26amp; Opens Customer table


CLEAR


SCAN FOR UPPER(country) = 'SWEDEN'


? contact, company, city


ENDSCAN


*-------------------------------------...





Turbo-C: switch-case-default:


The switch and case keywords evaluate expression and execute any statement associated with constant-expression whose value matches the initial expression.





If there is no match with a constant expression, the statement associated with the default keyword is executed. If the default keyword is not used, control passes to the statement following the switch block.


e.g.:


switch( c )


{


case 'A':


capa++;


case 'a':


lettera++;


default :


total++;


}


No comments:

Post a Comment