3 ms·
I think you could save time by showing people code like this: int x=5 % 3 and asking "What is the value of x?" Because a lot of jobs are CRUD and that form o
by mynameishere 14y ago
I think you could save time by showing people code like this:
int x=5 % 3
and asking "What is the value of x?" Because a lot of jobs are CRUD and that form of programming rarely involves the modulus operator.
- dllthomas 14y agoWell, assuming it's Haskell (given the lack of semicolon and otherwise valid Haskell syntax): x is an unused variable in the function "int" you're defining. This function returns the ratio (as a ratio, not a float) 5 / 3 for any argument, and is equivalent to "int = const (5 % 3)", which you would be more likely to see (probably inlined).
- mark-r 14y agoYou don't actually need the modulus operator, although it makes things simpler. Just use (x/3)*3==x instead.