Gambas/Difficult

From Wikibooks, open books for an open world
< Gambas
Jump to: navigation, search

What I think makes Gambas hard to use.[edit]

The only thing I find hard about Gambas is the lack of good tutorials.

Take the "goto" tutorial for example. I think this it is a very bad example on how to use the goto command.

Why? Because after studying it I still have trouble using the goto command. What would have been better is if the example just showed me how to goto a certain part.

like this:

  • a = print "hello"
  • goto a

or

  • a = print "hello"
  • b = print "gamabs"
  • goto a then b
  • goto b then a


Edit 10/3/06


First be aware that goto is bad programming practice. It is a holdover from the old days of GWBasic with its line numbers and lack of proper control structures.

Using goto creates code that is hard to follow and debug and lacks logical structure - so called spaghetti code.


That said, goto works like this


goto a

a:

Print "Hello World"

b:

Print "Hello Wicked World"


The output of this will be BOTH print statements because goto simply branches to the defined label and then continues to the end of the sub/function.

Change the goto to 'goto b" and only the second statement prints.


This example will not work in Gambas, but it wasn't meant to, I just wrote this to help you understand what I mean. I think all Gambas tutorials should start with very simple examples and work their way up to advance examples.