What does 'return' do in C++? 🔙

Поделиться
HTML-код
  • Опубликовано: 4 янв 2025

Комментарии • 18

  • @BroCodez
    @BroCodez  2 года назад +9

    Hey ya'll here's another example that might demonstrate the use of 'return' better.
    #include
    // Function to check if age is 18 or over
    bool isAdult(int age) {
    if (age >= 18) {
    return true;
    }
    else {
    return false;
    }
    }
    int main() {
    int age = 0;
    std::cout > age;
    if (isAdult(age)) {
    std::cout

  • @FrederikWollert
    @FrederikWollert 9 месяцев назад +3

    I really like your C++ series. Keep it up. Please make more C++ Videos. So, let's defeat the RUclips algorithm.

  • @artemzakharchuk2842
    @artemzakharchuk2842 Год назад +2

    #include
    #include
    double sum(float x, float y);
    int main(){
    float x = 5.6;
    double b = 2.3;
    float result = sum(a, b);
    std::cout

  • @Darkknight-vw6ye
    @Darkknight-vw6ye 2 года назад +8

    #include
    #include
    double calcultor(double sidea, double sideb);
    int main(){
    double x;
    double y;
    std::cout > x;
    std::cout > y;
    double lol = calcultor(x,y);
    std::cout

  • @printemps6158
    @printemps6158 Год назад

    #include
    double sum(double a, double b);
    int main(){
    double a = 5;
    double b = 4;
    double result = sum(a, b);
    std::cout

  • @deska3749
    @deska3749 Месяц назад

    Doesn't it loop on itself or ir overall less ificient?

    • @deska3749
      @deska3749 Месяц назад

      Ok nevermind I get it now

  • @bonnymich
    @bonnymich 3 месяца назад

    did you explain somewhere void keyword and i missed it?

    • @RandomCommentator15
      @RandomCommentator15 3 месяца назад +6

      I think he did not. For your understanding, "void" is a keyword which is used with a function when the function is not supposed to return anything. In the example, he is not returning anything from the function after the operations are completed, hence he used "void". :)

    • @bonnymich
      @bonnymich 2 месяца назад

      @@RandomCommentator15 thanks for the reply ill review the video and try to absorb it

  • @frekkytanish
    @frekkytanish 8 месяцев назад

    #include
    void fullname(std::string firstname , std::string lastname);
    int main(){
    std::string firstname = "bro";
    std::string lastname = "great";
    fullname(firstname , lastname);
    return 0;
    }
    void fullname(std::string firstname , std::string lastname){
    std::cout

  • @TahaProgrammer
    @TahaProgrammer Год назад +3

    is this important to learn?

    • @stellaroasis
      @stellaroasis Год назад +4

      obviously it is necesary to learn each and every concept

  • @johnny_ow
    @johnny_ow 7 месяцев назад

    #include
    #include
    double pythagStuff( double adjac, double oppie) ;
    int main()
    {

    double adjac;
    double oppie;
    std::cout