Author Topic: functions and facilities of O2  (Read 1277 times)

0 Members and 1 Guest are viewing this topic.

edcronos

  • Guest
functions and facilities of O2
« on: June 04, 2018, 05:22:40 AM »
I'm not sure where i put this.

I'm not ordering, just asking.


we are so focused on other things, that only now I have seen that the oxide help  aid has an index.

I've seen that O2 has an Enum
Code: [Select]
enum ManyThings
(
Shoes, Ships, SealingWax, Cabbages, Kings
)
ManyThings thing
thing = cabbages
print thing
if thing = cabbages then print "Cabbages!"

I found the usage a bit confusing, but ok

so is there something like?
Arry = Split ("aaa, bbb, ccc, ddd, eee", ",")
text = Join (Arry, ",")

although they are very easy to create manually, they are very useful
Split separates a text in an array by the delimiter
and Join joins an array into a text string separated by a delimiter

What would be the difference between Block and Scope?
can you name and make calls from the function of a specific Scope?
« Last Edit: June 04, 2018, 08:43:27 AM by edcronos »

Charles Pegge

  • Guest
Re: functions and facilities of O2
« Reply #1 on: June 06, 2018, 03:03:53 AM »
Hi Eduardo,

scope and block do the same thing. They hide new definitions from the rest of the code. They cannot be accessed from the outside.

You can also use namespace to confine definitions. Unlike scope, however, you can access them later.

Code: [Select]
'2018-06-06T12:00:01
'NAMESPACES

int i=1

namespace aa
int i=10
namespace bb
int i=20
namespace

print i + aa::i + bb::i '31

namespace bb
print i '20
namespace

edcronos

  • Guest
Re: functions and facilities of O2
« Reply #2 on: June 06, 2018, 04:55:44 AM »
Charles,
scope and block
have the ability to access global variables?
so I understood they would be of use only at the beginning of the execution,
but how would it be used in practice?

edcronos

  • Guest
Re: functions and facilities of O2
« Reply #3 on: June 06, 2018, 04:57:14 AM »
nor need to answer, I will not use this and can easily find out in the tests