• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

When should I use REF and when to use OUT?

I am confused about using REF and OUT. Can anyone please explain me when I should be using REF and OUT.
0
RajG1978
Asked:
RajG1978
1 Solution
 
Paul JacksonCommented:
A REF Parameter must be initialized before calling the function, whereas an OUT parameter does not.

Ref - the variable must be initialized before calling the function and will be modified by the called function.

Out - the variable does not need to be initialized before calling the function and will be initialized inside of the function.

A good example in the following link:

ref and out the inside story
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now