[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
if bIsEven = true { return true; } else { return false; }
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 24
Thread images: 3
File: 1454976821046.gif (2 MB, 250x200) Image search: [Google]
1454976821046.gif
2 MB, 250x200
if bIsEven = true {
return true;
} else {
return false;
}
>>
>>53706338
What's wrong with that
>>
>>53706589
Return biseven
>>
>>53706338
girls code is much clearer than boys.
>>
>>53706338
//a simple program that lets you no if bi = 7
>>
>>53706589
obvious first issue is that in most languages people use this is unlikely to be what the "programmer" intended. It uses assignment and most languages return the new lvalue's value in assignment statements. Which means it's always gonna return true and would be hard to see why unless you know this.

The other issue is obvious and it's absolutely shocking how many mediocre programmers shit up their source files with it. They wouldn't use OTB style though - expect every brace to be on a new line and some extra whitespace and a few comments also.
>>
>>53706338
if (bIsEven)
return true;
else
return false;
>>
>>53706734
return bIsEven;
>>
>>53706744
bIsEven;
>>
>>53706763
assumed to be the body of a function
>>
>>53706773
The function is pointless to begin with
>>
>>53706781
Also assumed that it's not the entirety of the body though.
>>
>>53706744
;)
you got it
>>
File: 1455078533532.webm (131 KB, 640x360) Image search: [Google]
1455078533532.webm
131 KB, 640x360
>>53706338
def isPrime(n):
for i in range(n-1,2):
if n%i = 0:
return False
return True
>>
>>53706877
ohh boy that's gonna take a long time
>>
>>53706877
What is the best way of doing this, efficiency and readability wise?
>>
>>53706911
Firstly to check for prime you'd only have to go from 2 to half the number

Secondly there are sieve things. Finding primes efficiently is a major field for cryptography purposes
>>
>>53706944
> half the number
I think you mean the square root of the number.
>>
>>53706973
You're right nigga, to power of half I meant to write
>>
File: OoP lady.jpg (25 KB, 429x501) Image search: [Google]
OoP lady.jpg
25 KB, 429x501
struct counter {
value i;
}

struct value {
uint16 j;
}]/code]
>>
if(ayy == 'lmao'){
return 'lmao';
} else {
return 'yolo'
}


who said girls couldn't code?
>>
>>53708432
Am I drunk?
This will always return lmao.
>>
>>53708614
why? anon didn't indent it properly but why would it?
>>
>>53709835
Hope can stay not by lmao
Thread replies: 24
Thread images: 3

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.