Created
May 21, 2020 05:03
-
-
Save Yrds/37f197a064818b00c94f548c917379a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const vect = [1, 2, 3, 4, 5, 6, 7, 8]; | |
const numberSix = vect.find(number => number == 6); | |
console.log(numberSix); //6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <functional> | |
int main(){ | |
std::vector<int> vect { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; | |
int numberSix = std::find_if_not(vect.begin(), vect.end(), [](int number) {return !(number == 6);})[0]; | |
std::cout << numberSix << std::endl; //6 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment