Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is +++ and <<< on Swift?

I just know from this github project that Swift has +++ and <<< "operators".

It's hard for me to search for this on google because +++ and <<< maybe some kind of special characters and not showing up on search result at all. It's not even showing up on questions that may already have your answer section of Stack Overflow when I wrote the question title.

Can you explain briefly what are these weird operators for, and maybe some articles link for further reading?

like image 727
Chen Li Yong Avatar asked Jul 15 '16 03:07

Chen Li Yong


People also ask

What is a swift code and how does it work?

When someone needs to transfer money internationally, they’ll need the SWIFT code for the receiving bank and the recipient’s account number. The sender’s bank will send a SWIFT message to the receiving bank to accept the transfer. Once the receiving bank approves the request, the transfer will be completed. What Does a SWIFT Code Look Like?

What is the full form of Swift?

SWIFT is short for Society for Worldwide Interbank Financial Telecommunications system. SWIFT is an information highway that connects banks located in different countries. The highway facilitates communication between them, and banks use the SWIFT network to send payment instructions or other information in a code.

Are sort codes the same as SWIFT codes?

Nope, sort codes aren’t the same as SWIFT codes. Sort codes are 6-digit codes that help British and Irish banks to identify bank branches for domestic payments (payments within a country). Do all banks use BIC/ SWIFT codes? No, all financial institutions, especially some small banks and credit unions, don’t have SWIFT codes.

What are the arithmetic operators in Swift?

Swift supports the four standard arithmetic operators for all number types: Unlike the arithmetic operators in C and Objective-C, the Swift arithmetic operators don’t allow values to overflow by default. You can opt in to value overflow behavior by using Swift’s overflow operators (such as a &+ b ). See Overflow Operators.


1 Answers

Those operators are not a part of Swift. They are defined within that repo and meaningful only within projects which include that module. Take a look at https://github.com/xmartlabs/Eureka/blob/master/Source/Core/Operators.swift#L27

infix operator +++{ associativity left precedence 95 }

and https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html for more on implementing custom operators in Swift.

like image 174
Jonah Avatar answered Oct 20 '22 00:10

Jonah