Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Source Help

Help Moving On elseif

A community discussion post from the original code:zIRON forum.

jackel member
Posts
19
Threads
6
Location
Unknown

Help Moving On elseif

okay im n00b at this code, i would like know which actions i should take next, ive tried this below elseif code and i can see the code, but whats the best easiest quickest correct procedure now, where to go from here?

program WIN32CUI 'test';
#include 'ch.zir';

  if (1 == 1) {
  eatnicefood
} elseif (1 == 2) {
  eatnicerfood
} else { 
  donteatnicefood 
}

Exitprocess(0); 

thx again

jack

jack.

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

I would first suggest to start setting up some real conditions and then move on to functions/procedures

program WIN32CUI 'test';
#include 'ch.zir';

//procedures here
procedure eatnicefood() {
   print('Yum, that was nice!\r\n');
}

procedure eatnicerfood() {
   print('Mmmm, that was delicious!\r\n');
}

procedure donteatnicefood() {
   print('I\'m starving.... feed me!\r\n');
}
//

eax = 1;

if (eax == 1) {
   eatnicefood();
} elseif (eax == 2) {
   eatnicerfood();
} else { 
   donteatnicefood(); 
}

Exitprocess(0); 

g'luck

jackel member
Posts
19
Threads
6
Location
Unknown

Hey thanks for the help i needed, I will follow them examples & see how i get on cheers for your time again respect what your doing mate

I will keep you posted n tnx for the gd-luck il need it :)

regards

jack ><

jack.

jackel member
Posts
19
Threads
6
Location
Unknown

Is this okay so far mate then i will move onto macros e.g eax = 1 etc ;-)

program WIN32CUI 'con-fun-pro';
#include 'ch.zir';
//TODO - Code
  if (1 == 1) {
  our hubs a private hub
} elseif (1 == 2) {
  you can use our public hub
} else {
  you can use any public hub
}

// conditions functions procedures

procedure our hubs a private hub() {
  print('But, you need to be a member to enter our hub!\r\n');
}
procedure you can use our public hub() {
  print('Hey, you need to find it before you can enter our public hub!\r\n');  
}
procedure why dont you try public hubs() {
 print('Aha, you wont have a problem finding and entering other hubs!\r\n);
}


Exitprocess(0); 

jack.

jackel member
Posts
19
Threads
6
Location
Unknown

Alright I`ve made a small mistake small one. I forgot to add --- >>[ ' ] after my last procedure call after \r\n'); instead i done --- >> \r\n); and missed out the all important --- >> [ ' ]

[code]

procedure why dont you try public hubs() {

print('Aha, you wont have a problem finding and entering other hubs!\r\n);

}

[\code]

when i should have called procedure this way

[code]

procedure why dont you try public hubs() {

print('Aha, you wont have a problem finding or entering other hubs!\r\n');

[\code]

i would have EDIT`d this but i think my browser hides the show edit button

REGARDS

jack

jack.

jackel member
Posts
19
Threads
6
Location
Unknown

This is the one i corrected so far so good YEAH

 program WIN32CUI 'con-fun-pro';
#include 'ch.zir';
//TODO - Code
  if (1 == 1) {
  our hubs a private hub
} elseif (1 == 2) {
  you can use our public hub
} else {
  you can use any public hub
}

// conditions functions procedures

procedure our hubs a private hub() {
  print('But, you need to be a member to enter our hub!\r\n');
}
procedure you can use our public hub() {
  print('Hey, you need to find it before you can enter our public hub!\r\n');  
}
procedure why dont you try public hubs() {
 print('Aha, you wont have a problem finding and entering other hubs!\r\n');
}


Exitprocess(0);

Respect

Jack

jack.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

functions and procedures can not contain multiple words

program WIN32CUI 'con-fun-pro';
#include 'ch.zir';

// conditions functions procedures

procedure our_hubs_a_private_hub() {
  print('But, you need to be a member to enter our hub!\r\n');
}
procedure you_can_use_our_public_hub() {
  print('Hey, you need to find it before you can enter our public hub!\r\n');  
}
procedure why_dont_you_try_public_hubs() {
 print('Aha, you wont have a problem finding and entering other hubs!\r\n');
}


//TODO - Code
if (1 == 1) {
  our_hubs_a_private_hub();
} elseif (1 == 2) {
  you_can_use_our_public_hub();
} else {
  you_can_use_any_public_hub();
}


Exitprocess(0);

You need to try compile your code when you make changes, the compiler will notify you about mistakes.