Odak modu
Control Structures-If Else
Code from video: https://solidity-by-example.org/if-else/
You can access the video content in Turkish prepared by İTÜ Blockchain here (between 00:00 - 18:43): https://www.youtube.com/watch?v=a9PtEe3CXSg&list=PLby2HXktGwN4Cof_6a8YwlMrboX8-hs73&index=6
This video explains how to write an if / else conditional statement in Solidity. Most of the control structures known from curly-brace languages are available in Solidity.
There is: if, else, while, do, for, break, continue, return, with the usual semantics known from C or JavaScript.
Solidity also supports exception handling in the form of try/catch-statements, but only for external function calls and contract creation calls. Errors can be created using the revert statement.
Parentheses cannot be omitted for conditionals, but curly braces can be omitted around single-statement bodies.
Note that there is no type conversion from non-boolean to boolean types as there is in C and JavaScript, so if (1) { ... } is not valid in Solidity.
There is also a shorthand way to write conditional statements using ternary operators.
Resources:
You can find detailed further information from Solidity Official documentation (in English):
https://docs.soliditylang.org/en/v0.8.15/control-structures.html
Sektörde en çok aranan yazılım becerilerini kazan
Yapay zeka desteği, birebir mentörlük saatleri, canlı dersler ve senin için özel hazırlanmış içeriklerle eksiklerini tamamla, düzenli geri bildirimler al ve öğrenme sürecini en verimli hale getir.
Yunus Emre Kabakcı
Patika+ mezunuPatika+ Fullstack Web Development Bootcamp mezunumuz Yunus Emre,
3 ay içinde Katar’dan aldığı teklif ile, global bir şirket olan Pavo Group’da işe başladı!
“İçerik zenginliği, mentor desteği, ileriye dönük bir network sağlaması ve dünyada en çok tercih edilen frameworkler üzerinden bir eğitim veriyor olması Patika+’ı tercih etmemin temel sebepleri oldu!“
Yorum yapabilmek için derse kayıt olmalısın!