Skip to content

Instantly share code, notes, and snippets.

@Yrds
Created May 21, 2020 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yrds/37f197a064818b00c94f548c917379a4 to your computer and use it in GitHub Desktop.
Save Yrds/37f197a064818b00c94f548c917379a4 to your computer and use it in GitHub Desktop.
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