Prev | Current Page 177 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


Returning a value from an if statement printed on a single line facilitates the same functionality as that
of the ternary operators in the C language:
var myInt = if ( myVal == ???one??? ) 1 else 2;
Which is the same as the C equivalent:
int myInt = ( strcmp( myVal, ???one??? ) ) ? 1 : 2;
When returning a value from a switch or if statement, it is important to make sure that the type of the
values being returned are matched, otherwise a compiler error will ensue. If no value is meant to be
returned, then the values that may return by accident, such as those supplied indirectly by a function
call, may be of differing types. If no value is returned within an if or switch statement, then the type
Void is returned.
Loops
Computers are very linear machines, and a processor, with some exceptions, can only perform one
instruction at any one time. Sure, your machine may look like it ??™ s doing an awful lot at once, but in
reality it is merely performing processes on one area of information, known as a thread, at a time.


Pages:
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189