开始使用免费开始使用

If-else practice

Conditional statements will come up in your code in lots of places, so its really important you are comfortable with them.

In the following samples you are writing little pieces of code to:

  1. Find the absolute value of a number
  2. Find the maximum value of two numbers
  3. Print a message if your script has finished

The variables you need to complete these examples, x, y, and finished are available in your environment.

本练习是课程的一部分

Introduction to Julia

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Print x if it is positive, otherwise print -x
____
	println(x)
____
	println(-x)
____
编辑并运行代码