0Pricing
Mojo Academy · Ders

Değişime İlk Bakış

Diğer kodları bozmadan verileri değiştirin.

Değişime İlk Bakış, CoddyKit'te ücretsiz bir Mojo Academy dersidir. Bu, 4 dersinin 4. 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, Mojo Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Mojo Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Changing Data On Purpose

Independent copies are great, but real programs must mutate data: update a score, grow a list. Let us do it safely. ✏️

Mutating Your Own var

The simplest mutation is reassigning a var you own. Since it is your copy, the change affects only your value.

var score = 10
score = score + 5

Local Mutation Is Free of Side Effects

Editing a local var cannot leak outward. Other variables keep their values, so the change has no surprise side effects.

var a = 1
var b = a
a = 100

Functions Get Copies By Default

Pass a value to a function and it edits a copy. Your original outside the function is left untouched.

fn bump(n: Int) -> Int:
    return n + 1

But Sometimes You Want Real Change

What if a function should update the caller's value in place? Mojo lets you opt in with the inout convention.

inout Means Mutate In Place

Mark an argument inout and the function works on the caller's actual value, so its edits truly stick.

fn double(inout n: Int):
    n = n * 2

Mutation Is Explicit, Not Accidental

Notice you had to write inout on purpose. Mojo never mutates the caller behind your back; you always opt in.

Reading the Signature Tells You

The function signature reveals intent. See inout and you know your value may change; otherwise expect a safe copy.

Calling an inout Function

Call it with your var and watch the value update right where it lives. The function reached your original, by design.

var n = 4
double(n)
print(n)

A Balanced Approach

Mojo blends both worlds: safe copies by default, deliberate mutation when you ask. You get safety and flexibility together.

What Comes Next

This is just a first taste. Later you will meet owned and the transfer operator for full control over how data moves. 🚀

Quick Check

You want a function to change the caller's actual value, not a copy. What do you use?

Recap

Mutating your own var is safe and local. To change a caller's value, opt in with inout; nothing mutates by accident. 🎯

Sıkça Sorulan Sorular

“Değişime İlk Bakış” dersi ücretsiz mi?

Evet — “Değişime İlk Bakış” 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 Mojo Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Mojo Academy kursu toplamda 4 dersten oluşur.

“Değişime İlk Bakış” dersinde ne öğreneceğim?

Diğer kodları bozmadan verileri değiştirin. Mojo Academy 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.

Mojo Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Mojo Academy, 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, 4 dersinin 4. dersidir.

“Değişime İlk Bakış” 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 Mojo Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Mojo Academy 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

  1. Değer Anlambilimi Ne Anlama Gelir?
  2. Kopyalar ve Paylaşılan Durum
  3. Mojo'nun Güvenli Varsayılanı
  4. Değişime İlk Bakış
← Mojo Academy Sayfasına Dön