Choco OS  V.0.16.9.0
Join to the chocolate world
oc_forif.h File Reference

Definition of forif macro loop. More...

Go to the source code of this file.

Macros

#define forif(INITIALS, CONDITION, INCREMENTS)
 for-loop with else condition More...
 

Detailed Description


Author
Patryk Kubiak - (Created on: 11 kwi 2015 12:45:47)
Note
Copyright (C) 2015 Patryk Kubiak patry.nosp@m.k.ku.nosp@m.biak9.nosp@m.0@gm.nosp@m.ail.c.nosp@m.om
           This program is free software; you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
           the Free Software Foundation; either version 2 of the License, or
           (at your option) any later version.

           This program is distributed in the hope that it will be useful,
           but WITHOUT ANY WARRANTY; without even the implied warranty of
           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
           GNU General Public License for more details.

           You should have received a copy of the GNU General Public License
           along with this program; if not, write to the Free Software
           Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Definition in file oc_forif.h.

Macro Definition Documentation

#define forif (   INITIALS,
  CONDITION,
  INCREMENTS 
)

The macro is the loop with else condition. You can use it as standard 'for'.

Parameters
INITIALSOperation, that should be performed before the loop. There is one restriction, that in initials you cannot declare a variable.
CONDITIONThe condition to check before each iteration
INCREMENTSIncrement variable operation (only for example)
int i = 0;
int count = 10;
scanf("%d" , &count);
forif(i=0,i<count,i++)
printf("i=%d\n", i);
else
printf("count is 0\n");

Definition at line 54 of file oc_forif.h.