Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const vect = [1, 2, 3, 4, 5, 6, 7, 8];
const numberSix = vect.find(number => number == 6);
console.log(numberSix); //6
#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