अपना फ़ंक्शन लिखना

इंटरमीडिएट Julia

Anthony Markham

Quantitative Developer

Structs पुनरावलोकन

  • Structs, composite types का अनुप्रयोग हैं.
  • ये दूसरे types जैसे ही होते हैं, बस इनमें आप चाहें उतने fields रख सकते हैं.
mutable struct House
    bedrooms::Int64
    bathrooms::Int64
    location::String
    price::Float64
end
my_house = House(3, 2, "Sydney", 1500000)
  • कई programming languages में वास्तविक समस्याएँ सुलझाने के लिए आम हैं.
इंटरमीडिएट Julia

Functions और custom structs

mutable struct Person
    age::Int64
    height::Int64
    location::String

    function Person(age, height)
        new(age, height, "London")
    end
end

steve = Person(19, 180)
Person(19, 180, "London")
इंटरमीडिएट Julia

Functions पुनरावलोकन

  • अलग-अलग argument types को फ़ंक्शन में कैसे पास करें
function arg_types(pos, ; key)
    return pos, key
end
  • variable संख्या में arguments फ़ंक्शन को कैसे पास करें
function vararg_names(names...)
    return names
end
  • फ़ंक्शन से output कैसे लौटाएँ
function return_x_times_y(x, y)
    return x * y
end
  • Functions लचीले होते हैं और अपने फ़ंक्शन लिखना programming का बुनियादी हिस्सा है.

  • व्यावहारिक, वास्तविक समस्याएँ सुलझाना code सीखने का मुख्य भाग है.

इंटरमीडिएट Julia

अभ्यास करते हैं!

इंटरमीडिएट Julia

Preparing Video For Download...