Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I'm a Python novice and even *I* know that's shit. First thing I thought was why not use a for loop.
-
Root797706ySo a lengthy single-purpose switch inside a loop is okay, but a tiny nested loop is shitty?
Why?
... Though actually, why use a block at all?
for($item in $items) {
echo str_repeat($star, $item->stars);
// whatever else
} -
Root797706y@Bitwise Both the loop and conditional are pointless if you know $object->stars is withun (0..5). Just repeat the markup $stars times and echo it. That likewise handles not displaying anything when the count is zero.
Unless I'm misunderstanding you? -
Sometimes I ask myself if I am doing something wrong when I am just using loops etc. for making stacked tags.
It seems like you don't do that.
Related Rants
Reason # 567 Why i want to murder my colleague.
rant
html
website
django
ifelse