Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 2.4

COLUMN

Comparing Syntaxes and Structures

Get comfortable coding in REALbasic

Issue: 2.4 (March/April 2004)
Author: Owen Yamauchi
Author Bio: Owen Yamauchi is a freelance programmer who has been programming REALbasic since version F4. He is the Lead Programmer for Domain Softworx, a company that produces developer tools for REALbasic.
Article Description: No description available.
Article Length (in bytes): 8,373
Starting Page Number: 35
Article Number: 2416
Related Web Link(s):

http://www.domainsoftworx.com/
http://www.planet-source-code.com/

Excerpt of article text...

Last issue, we introduced this column with an overview of the similarities and differences between Microsoft Visual Basic (VB) and REAL Software's REALbasic (RB), concentrating mainly on their interfaces. In this installment, we'll concentrate on the back end: the code you use to make your programs work. I'll assume that you're already familiar with the interface of RB, and that you have at least a basic knowledge of VB's interface.

You'll find that overall, RB's implementation of BASIC is more strict in terms of syntax than VB. When I first started learning VB, I always religiously declared my variables (with "DIM" statements at the beginning of a block of code). VB users may be a bit concerned when they find that all variables must be declared. In recent versions of RB (after 5.0), the declarations do not have to be at the beginning of the code block, whereas they did previously. In turn, RB users who are looking into VB might find it strange that you do not have to declare variables in VB. There is a way to enforce declaration of variables in VB: put the line Option Explicit in the global declarations of the code for a form or module. However, this need not concern us here. The bottom line: in RB, always declare your variables!

RB also requires that variables be typed. For example, in VB, this declaration is sufficient: Dim Temp. This creates a variable (which behaves as a Variant) called Temp. This would not be permitted in RB; you would have to declare: Dim Temp as Variant. VB is very relaxed about types in that respect.

In VB, this code is also permissible:

Dim a as Integer

Dim b as String

...End of Excerpt. Please purchase the magazine to read the full article.