Tuples are a simple and versatile data structure in Rust that allow you to group multiple values of different types into a single compound value. They are particularly useful for returning multiple values from a function.
Tuples can return multiple values of different types, which is not possible with arrays or slices. For example a tuple could be (i32, f64, String)
which contains an integer, a float, and a string.
In this challenge, you will implement a function that takes three arguments of different types and returns them as a tuple.
You need to implement the function create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String)
that takes an integer i32
, a float f64
, and a string slice &str
as input and returns them as a tuple. The string slice should be converted into a String
type.
create_tuple
function should return a tuple containing the three input values in order.String
before returning.()
to define and return the tuple.&str
to String using String::from()
or the .to_string()
method.qiyuan711
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, c.to_owned())}
tuusberg
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a, b, String::from(c))}
apst
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, String::from(c))}
Samthewriter77
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a,b, c.to_string())}
jw
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
nickythorne
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
terminox
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, String::from(c))}
ryzen-xp
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a , b , String::from(c))}
Derteq
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, String::from(c))}
chuyuanlinzi
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
DV-13
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, String::from(c))}
tinthid
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a , b, c.to_string())}
yoakemae
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a, b, c.to_string());}
martin-unit
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
Neil-Rayu
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a,b,c.to_string());}
RonaldoArayadev
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
3ok
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
leenalmajz
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a, b, c.to_string())}
Thymelizabeth
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, c.into())}
devarajang
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a, b, String::from(c));}
amilcarrey
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a, b, String::from(c))}
jeypiti
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
konishu
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a, b, c.to_string())}
dalprahcd
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a,b,c.to_string())}
nichideropa
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
aleksey-vareto
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a,b,c.to_string())}
akshayabhattarai
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
oDqnger
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a,b,c.to_string())}
hatchepsut
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, c.to_string())}
otakumesi
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
matsuyama-k1
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a, b, String::from(c))}
sy34
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a, b, c.to_string());}
matsuby
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a, b, c.to_string());}
ankeetparikh
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, String::from(c))}
0xsmarter
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a, b, c.to_string())}
aidan1magee
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a,b,c.to_string())}
maxvi
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
Samthewriter77
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a,b, c.to_string())}
hfm
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a, b, c.to_string())}
P0TER19
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here let tup:(i32,f64,String)=(a,b,String::from(c)); return tup}
ugochukwudev
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a,b,c.to_string())}
rafaellucasprogm
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
WalquerX
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
koslowskio
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a,b, String::from(c))}
cloki0610
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
Brack0
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, c.to_string())}
shinuza
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, String::from(c))}
tsucchinoko
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
prajval-malhotra
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a, b, c.to_string());}
whitwulf
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}