Assignment to multiple variables with the ternary operator

I had to confront the ruby code for the first time in 10 years

python


$ ruby -e 'i, j = 1 ? [1,2]:[3,4] ; p i, j'
1
2

It's like a fool who worried for a few hours because of this

Recommended Posts

Assignment to multiple variables with the ternary operator
About the ternary operator
[Ruby] I tried to diet the if statement code with the ternary operator
How to change the action with multiple submit buttons
Is the ternary operator evil?
A confused story about a ternary operator with multiple conditional expressions
To display multiple lines with UILabel
How to write a ternary operator
Today's memo (subscript operator, multiple assignment)
Setting to start multiple units at the same time with Vagrant
Try using || instead of the ternary operator
How do you write the ternary operator (? :)
I was addicted to unit testing with the buffer operator in RxJava
[Rails] How to register multiple records in the intermediate table with many-to-many association
Print forms directly to the printer with JasperReports
How to save to multiple tables with one input
How to search multiple columns with gem ransack
[Swift] How to link the app with Firebase
How to create multiple pull-down menus with ActiveHash
FactoryBot Register multiple data with the same model
pass two arguments to the URI with link_to
How to create member variables with JPA Model
Getting Started with Doma-Introduction to the Criteria API
Try to summarize the common layout with rails
[MASCHINE Learning] Linear Regression with One Variable
Supports multiple test cases with one method with @ParameterizedTest!
Assignment to multiple variables with the ternary operator
Integration Test with Gradle
[Rails] Test with RSpec
Test Nokogiri with Rspec.
Automatically test with Gauge
Load test with JMeter
Unit test with Junit.
I want to change the path after new registration after logging in with multiple devises.
Reference ternary operator
Use the --build-arg option of docker-compose to pass environment variables to the container built with Dockerfile
I want to hit the API with Rails on multiple docker-composes set up locally
A warning is displayed when trying to use a huge integer with the special variables $ 1, $ 2, $ 3 ...
How to embed JavaScript variables in HTML with Thymeleaf
[Rails] How to search by multiple values ​​with LIKE
`Failed to create the host-only adapter` with docker-machine start`
I want to dark mode with the SWT app
[Java] Refer to and set private variables with reflection
Organized how to interact with the JDK in stages
HTTPS connection with Java to the self-signed certificate server
Addicted to the webpacker that comes standard with Rails 6
I want to be aware of the contents of variables!
[Ruby] Conditional expression without if? Meaning of (question mark). How to use the ternary operator.
How to use the same Mapper class in multiple data sources with Spring Boot + MyBatis