Solidity'ye Giriş
Pragma ve contract anahtar sözcükleri de dahil olmak üzere Solidity'nin söz dizimine, yapısına ve temel sözleşme bildirimine genel bakış edinin.
Solidity'ye Giriş, CoddyKit'te ücretsiz bir Web3 & DApp Development Fundamentals dersidir. Bu, 3 dersinin 1. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Web3 & DApp Development Fundamentals öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Web3 & DApp Development Fundamentals kursu toplamda 3 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Meet Solidity: Language of Smart Contracts
Welcome to Solidity! It's the primary language for writing smart contracts on blockchain platforms like Ethereum.
Think of smart contracts as self-executing agreements stored on a blockchain. Learning Solidity opens the door to building decentralized applications (DApps).
Why Solidity Matters
Solidity is a high-level, object-oriented language. It's specifically designed to implement business logic for DApps.
It enables you to create digital tokens, build decentralized finance (DeFi) protocols, and manage digital assets securely on a blockchain.
Your First Solidity File
Every Solidity smart contract lives in a file ending with the .sol extension.
- Just like a
.jsfile for JavaScript. - Or a
.pyfile for Python. - The first line of a Solidity file often defines the compiler version to be used.
The Pragma Directive
The pragma directive is crucial. It tells the Solidity compiler which version to use for your contract.
For example, pragma solidity ^0.8.0; means "use any compiler version from 0.8.0 up to, but not including, 0.9.0."
This ensures your contract compiles predictably and avoids unexpected behavior from future compiler changes.
Declaring a Contract
In Solidity, the fundamental building block for your smart contract is the contract keyword.
- It's similar to a "class" in object-oriented programming languages.
- Your entire smart contract's logic, including variables and functions, will live inside a
contractblock.
Our First Basic Contract
Let's put pragma and contract together. This is the most basic, yet complete, Solidity contract you can write.
It doesn't do much yet, but it's ready to be compiled and deployed!
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract MyFirstContract {
// This contract is currently empty!
}Comments in Solidity
Comments help explain your code to others and your future self. They are ignored by the compiler.
- Single-line comments start with
//. - Multi-line comments are enclosed by
/*and*/. - The
SPDX-License-Identifieris a special comment used to specify the contract's license.
Contract Name & Structure
Contract names usually start with an uppercase letter, following common programming conventions (e.g., MyFirstContract).
The code inside the curly braces {} defines the contract's logic. This is where you'll add state variables, functions, and events as you learn more.
Quick Check: Pragma Purpose
The pragma solidity ^0.8.0; line is essential for smart contract development. What is its primary role?
Recap: Your Solidity Journey Begins!
You've learned the very basics of Solidity!
- We covered the
.solfile extension. - The critical
pragmadirective for compiler versions. - The fundamental
contractkeyword. - How to add comments for code clarity.
Next, we'll dive deeper into variables and data types!
Sıkça Sorulan Sorular
“Solidity'ye Giriş” dersi ücretsiz mi?
Evet — “Solidity'ye Giriş” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Web3 & DApp Development Fundamentals kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Web3 & DApp Development Fundamentals kursu toplamda 3 dersten oluşur.
“Solidity'ye Giriş” dersinde ne öğreneceğim?
Pragma ve contract anahtar sözcükleri de dahil olmak üzere Solidity'nin söz dizimine, yapısına ve temel sözleşme bildirimine genel bakış edinin. Web3 & DApp Development Fundamentals ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Web3 & DApp Development Fundamentals öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Web3 & DApp Development Fundamentals, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 3 dersinin 1. dersidir.
“Solidity'ye Giriş” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Web3 & DApp Development Fundamentals dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Web3 & DApp Development Fundamentals dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Solidity'ye Giriş
- Değişkenler ve Veri Türleri
- İşlevler ve Denetim Yapıları