<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Oluborode Akintunde Paul</title>
    <description>The latest articles on Forem by Oluborode Akintunde Paul (@bigfidelis).</description>
    <link>https://forem.com/bigfidelis</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F551855%2Fb309ea1b-6963-4eee-85a5-77b36b36a453.jpg</url>
      <title>Forem: Oluborode Akintunde Paul</title>
      <link>https://forem.com/bigfidelis</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/bigfidelis"/>
    <language>en</language>
    <item>
      <title>Learn Function in Dart</title>
      <dc:creator>Oluborode Akintunde Paul</dc:creator>
      <pubDate>Sun, 12 Feb 2023 05:57:18 +0000</pubDate>
      <link>https://forem.com/bigfidelis/learn-function-in-dart-314e</link>
      <guid>https://forem.com/bigfidelis/learn-function-in-dart-314e</guid>
      <description>&lt;p&gt;What is a function?&lt;br&gt;
 In Dart, a function is a block of code that takes inputs, performs some operations, and returns an output. Functions help to encapsulate a specific behavior or calculation and make it reusable throughout your code. Functions can be declared either as a standalone function or as a method within a class.&lt;br&gt;
``&lt;br&gt;
&lt;strong&gt;Examples on function&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;br&gt;
void main(List args) {&lt;br&gt;
  // this is a string declared function&lt;br&gt;
  String eatBeans() {&lt;br&gt;
    return "i cooked beans";&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;// nesting a function to another function&lt;br&gt;
  String? newFunction() {&lt;br&gt;
    return eatBeans();&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;//print(newFunction());&lt;br&gt;
  // this is a positional function&lt;br&gt;
  void myEat(int x, double y, String? food) {&lt;br&gt;
    return print("$x , $y, $food ");&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;myEat(1, 2.5, "bread");&lt;br&gt;
// this is optional positional argument&lt;br&gt;
  void optionalMyEat(int x, double y, [String? food]) {&lt;br&gt;
    return print("$x , $y, $food ");&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;optionalMyEat(2, 3.5);&lt;br&gt;
// this is named optional positional argument&lt;br&gt;
  void myNameEat({int? x, double? y, String? food}) {&lt;br&gt;
    return print("$x , $y, $food ");&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;//combine named parameters with positional parameters&lt;br&gt;
  myNameEat(x: 5, y: 4.5, food: "rice");&lt;/p&gt;

&lt;p&gt;int myAdd(int x) {&lt;br&gt;
    return x + 10;&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;print(myAdd(20));&lt;/p&gt;

&lt;p&gt;// we can program easily using arrow function&lt;/p&gt;

&lt;p&gt;int plus(int y, int x) =&amp;gt; y + x;&lt;br&gt;
  print(plus(4, 3));&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;// creating something different using typedef&lt;br&gt;
typedef transform = int Function(int);&lt;br&gt;
transform twice(transform f) {&lt;br&gt;
  return (int x) {&lt;br&gt;
    return f(f(x));&lt;br&gt;
  };&lt;br&gt;
}&lt;br&gt;
&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
