![]() |
&& operator - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: General Help (/Forum-General-Help) +--- Thread: && operator (/Thread-operator) |
&& operator - darksun84 - 04-03-2012 11:18 PM Hello , just a quick question , is the operator && short-circuited in sphere ? RE: && operator - dagger4k - 04-03-2012 11:31 PM what do you mean by short circuited RE: && operator - darksun84 - 04-03-2012 11:40 PM Like a = 0 b = 1 if (a != 0 && b ==1 ) If the && operator is short circuited ,the second operation (b==1 ) doesn't get evaluated because the first operation is false . Instead , if the && operator is not short circuited , the second operation will be anyway executed even if it's useless to evaluate it . Better explained ![]() RE: && operator - Shaklaban - 04-04-2012 12:57 AM i think it is not, im tested it like this: Code: [function short_bla] RE: && operator - ShiryuX - 04-04-2012 01:07 AM It is not. Code: [function fTest] Code: 12:06:(sphere_test.scp,19)we're firing this anyway Got to admit something: 1. I forgot to add < > to f_test 2. Instead of return 1, I used return true. 3. Probably, this is because I got used to C++ ![]() |