Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

#CodingResolutions: Programming Fundamentals – Variables and Variable Scope

Author: Rebekah D

So far in the #CodingResolutions series, we’ve worked a lot in the visual design framework to demonstrate how easy it is to create low-code apps. It’s instant gratification to see our apps come to life!  However, there’s a lot more to programming so let’s get down to work. 

In this post, let’s look at some programming fundamentals and explore variables and what variable scope means in Delphi and C++. 

C++ Variables and Variable Scope

Do you understand the difference between block, function, namespace and class scope for C++ variables? Depending on where you declare your variables, you may be able to access them from only a small portion of your program or from the entire program. There are performance trade-offs when you create global variables that are rarely needed, so make sure you’re using the right kind. 

Watch this video for an introduction to variables and variable scope: https://embt.co/CPPScope

For additional reading on C++ variables, head over to this article

Delphi Variables and Variable Scope

Learn how Delphi programs use and store data with variables, how to declare variables, and data types: https://embt.co/DelphiDataTypes.

For experienced developers, you can now use inline variables in Delphi 10.3 Rio: https://embt.co/InlineVariables

Previous #CodingResolution posts: 

Exit mobile version