Anyone else go to a retarded university? Earlier this week my dumbass professor asked me why I keep using ternary operators and hex numbers in my homework.
What was your answer?
>>51559392
Don't you have a street to poo into rajeesh?
>>51559431
They're faster and more efficient.
I go to a uni where all of my professors are either Chinese or Indian
>tfw code in PowerPoint slides contains basic errors
>tfw every class is in Java or PHP
>tfw they teach us to uselessly comment every like //increment i by one
>>51559392
>retarded university
If you can't afford/manage to get into the best in your country why even bother going to uni tbqh pham?
Polimi master race reporting in
>>51559452
Not really: ternaries compile just the same as if-statements (with conditional branches, or very occasionally conditional-coded instructions on legacy ARM), and basically any literal constant is equivalently referenced.
Be careful of ternaries. While they are useful syntactic shortcuts, careless use can bite you where you least expect it sometimes, especially in duck-typed languages where which things are 'truthy' and 'falsey' when coerced into a boolean are not necessarily obvious: PHP's a poster child for that, but so is javascript. The same can be true of using inline (statemented) if/then/else constructs in the languages that support it - I frequently used it in Lua as a nil-squasher, but you need to be vigilant about in which circumstances it could fuck things up.
Clear formatting can be challenging, too. It can look quite nice sometimes as:variable = expression
? value_if_true
: value_if_false;
>>51559461
I hate that comment every line crap. If you write good code it shouldn't be necessary to explain every single line. This is only acceptable somewhat in assembly.
>>51559452
Your uni is dumb, but you're equally as dumb if you actually responded with that.
>>51559833
>PHP's a poster child for that
PHP evaluates ternaries from right-to-left, which is why it confuses fucking everybody.
>>51559392
>at uni
>computing lecture
>slides on laptop through laptop, stepping through, not on slideshow
>look at taskbar, bubble about bluetooth
>try to connect to laptop from phone
>security popup, laptop makes a noise
>lecturer gets flustered
>5 minutes later gets popup to go away
>doesn't turn off bluetooth, doesnt silence.
>repeat for the rest of the class
>>51559392
>frogposter
Makes sense.