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

my 1st ever try if; elseif; else; . jack

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

jackel member
Posts
19
Threads
6
Location
Unknown

my 1st ever try if; elseif; else; . jack

if (1 == 1) {

eatnicefood

} elseif (1 == 2) {

eatnicerfood

} else {donteatnicefood {

}

Exitprocess(0);

jack.

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

first problem i see is you did not use

[code]your code here

[/code]

ok at your code, your else has a small problem:

} else {donteatnicefood {

should be

} else {
   donteatnicefood
}

and then remove the final }

take a look here "Control Structures" for more info.

jackel member
Posts
19
Threads
6
Location
Unknown
if (1 == 1) {
  eatnicefood
} elseif (1 == 2) {
  eatnicerfood
} else { 
  donteatnicefood 
}

Exitprocess(0);

EDIT by Admin - added code block

jack.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

when posting code, put it inside

[code]

[/code] brackets

ps if you want to see some visual output for testing

if (1 == 1) {
  print('eat nice food\r\n');
} elseif (1 == 2) {
  print('eat nicer food\r\n');
} else { 
  print('don\'t eat nice food\r\n');
}
jackel member
Posts
19
Threads
6
Location
Unknown

il use:

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

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

Exitprocess(0); 

jack.