Scratch To Unity: Operators

Beginner Scratch Tutorial Unity

This post provides a handy reference guide to go from Scratch’s “Operators” category of code blocks to C# with Unity.

Is College Free in Germany? Here’s The Truth!
Tuesday April 30, 2019

Studying in Germany is a lifetime opportunity for many students, but is college free in Germany like many people claim? You’ll find all the details in this article. German colleges are consistently ranked among the world’s best and their quality is above global education standards. But many international students think that popularity and high costs […]

The post Is College Free in Germany? Here’s The Truth! appeared first on Dua xe moto.

Code Blocks
Click on the picture of any of these Scratch code blocks to see how to write similar code statements in C#.

Best Colleges in Germany for American Students
Tuesday May 07, 2019

Are you an ambitious student from the US who is considering options to study abroad and Germany has caught your attention? However, you have no or little idea as to what are the best colleges in Germany for American students. Over 370,000 current international students in Germany, including over 6,800 American students can relate to your […]

The post Best Colleges in Germany for American Students appeared first on Dua xe moto.

int score = 5 + 6; // 11
int age = score + 1; // 12
int total = score + age; // 23
score += 1; // 12
score++; // 13

int score = 10 – 5; // 5
int age = score – 1; // 4
int total = score – age; // 1
score -= 1; // 4
score–; // 3

int score = 3 * 5; // 15
int age = score * 2; // 30
int total = score * age; // 450
score *= 3; // 45

COVID-19: Berlin Announces New Measures for Summer Semester
Monday April 13, 2020

The Governing Mayor of Berlin Senate Chancellery – Higher Education and Research has announced that universities in Berlin will start their summer semester on April 20, with a three-week delay, due to the Coronavirus pandemic. As the pandemic has affected all spheres of life in Germany and abroad, including the education system, Berlin as the […]

The post COVID-19: Berlin Announces New Measures for Summer Semester appeared first on Dua xe moto.

int score = 10 / 3; // 3
double amount = 7.0 / 2.0; // 3.5
int total = score / score; // 1
score /= 3; // 1

int score = Random.Range(1, 11); // Could be one of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
float time = Random.Range(0f, 1f); // Could be any value between 0 (inclusive) and 1 (inclusive)
float amount = Random.value; // Could be any value between 0 (inclusive) and 1 (inclusive)

bool result = 10 > 3; // true
result = 3 > 10; // false

bool result = 10 < 3; // false
result = 3 < 10; // true

bool result = 10 == 10; // true
result = 10 == 3; // false

bool result = true && true; // true
result = true && false; // false
result = false && true; // false
result = false && false; // false

bool result = true || true; // true
result = true || false; // true
result = false || true; // true
result = false || false; // false

bool test = false; // false
test = !test; // true

string name = "Jon" + " the great!"; // "Jon the great!"
string firstName = "Jon";
string lastName = "Parham";
string fullName = string.Concat(firstName, " ", lastName); // "Jon Parham"
string[] fruits = { "banana", "grape", "strawberry" };
string allFruits = string.Join(", ", fruits); // "banana, grape, strawberry"

string name = "Jon";
string firstLetter = name.Substring(0, 1); // "J"
string secondLetter = name.Substring(1, 1); // "o"
string lastTwoLetters = name.Substring(1, 2); // "on"

string fruit = "apple";
int letterCount = fruit.Length; // 5

string fruit = "apple";
bool test = fruit.Contains("a"); // true
test = fruit.Contains("app"); // true
test = fruit.Contains("b"); // false

int mod = 10 % 3; // 1

float result = Mathf.Round(3.2f); // 3
result = Mathf.Round(3.7f); // 4

float result = Mathf.Abs(-3f); // 3

float result = Mathf.Floor(3.7f); // 3

float result = Mathf.Ceil(3.3f); // 4

float result = Mathf.Sqrt(4f); // 2

float result = Mathf.Sin(4f); // -0.7568025

float result = Mathf.Cos(4f); // -0.6536436

float result = Mathf.Tan(4f); // 1.157821

float result = Mathf.Asin(0.5f); // 0.5235988

float result = Mathf.Acos(0.5f); // 1.047198

float result = Mathf.Atan(0.5f); // 0.4636476

float result = Mathf.Log10(100f); // 2

float e = (float)System.Math.E;
float result = Mathf.Pow(e, 2); // 7.389056

float result = Mathf.Pow(10, 2); // 100

Links
Here are a few links that are relevant to this material and can help you dive a little deeper if you need more help.

Random
Mathf
String
Scratch Wiki for Operators Block

Summary
This should cover all of the code blocks in Scratch’s “Operators” category. If you have any questions about this reference guide feel free to ask below.
If you find value in my blog, you can support its continued development by becoming my patron. Visit my Patreon page here. Thanks!